def _check_no_current_table(new_obj, current_table):
    """ Raises exception if we try to add a relation or a column
    with no current table. """
    if current_table is None:
        msg = 'Cannot add {} before adding table'
        if isinstance(new_obj, Relation):
            raise NoCurrentTableException(msg.format('relation'))
        if isinstance(new_obj, Column):
            raise NoCurrentTableException(msg.format('column'))
dataset/ETHPy150Open Alexis-benoist/eralchemy/eralchemy/parser.py/_check_no_current_table/original