def _guess_name_of(self, expr):
if isinstance(expr, ast.Var):<EOL><INDENT>return expr.value<EOL><DEDENT>if isinstance(expr, ast.Resolve):<EOL><INDENT>return expr.rhs.value<EOL><DEDENT>if isinstance(expr, ast.Select) and isinstance(expr.rhs, ast.Literal):<EOL><INDENT>name = self._guess_name_of(expr.lhs)<EOL>if name is not None:<EOL><INDENT>return "<STR_LIT>" % (name, expr.rhs.value)<EOL><DEDENT><DEDENT>if isinstance(expr, ast.Apply) and isinstance(expr.func, ast.Var):<EOL><INDENT>return expr.func.value<EOL><DEDENT>
Tries to guess what variable name 'expr' ends in.

        This is a heuristic that roughly emulates what most SQL databases
        name columns, based on selected variable names or applied functions.