(expression)
Return the object corresponding to expression evaluated
    in a namespace spanning sys.modules and __main.dict__.
Return the object corresponding to expression evaluated
    in a namespace spanning sys.modules and __main.dict__.
Return the object corresponding to expression evaluated in a namespace spanning sys . modules and __main . dict__ .
def get_entity(expression):
    """Return the object corresponding to expression evaluated
    in a namespace spanning sys.modules and __main.dict__.
    """
    if expression:
        namespace = {**sys.modules, **__main__.__dict__}
        try:
            return eval(expression, namespace)  # Only protect user code.
        except BaseException:
            # An uncaught exception closes idle, and eval can raise any
            # exception, especially if user classes are involved.
            return None
def get_entity ( expression ) : if expression : namespace = { * * sys . modules , * * __main__ . __dict__ } try : return eval ( expression , namespace ) # Only protect user code. except BaseException : # An uncaught exception closes idle, and eval can raise any # exception, especially if user classes are involved. return None