<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def same_pyname(expected, pyname):
 """Check whether `expected` and `pyname` are the same"""

    if expected is None or pyname is None:
        return False
    if expected == pyname:
        return True
    if type(expected) not in (pynames.ImportedModule, pynames.ImportedName) \
        and type(pyname) not in \
            (pynames.ImportedModule, pynames.ImportedName):
        return False
    return expected.get_definition_location() == \
        pyname.get_definition_location() and \
        expected.get_object() == pyname.get_object()