'Return namespace where reference name is defined
It returns the globals() if reference has not yet been defined'

def _get_reference_namespace(self, name):

    glbs = self._mglobals()
    if (self._pdb_frame is None):
        return glbs
    else:
        lcls = self._pdb_locals
        if (name in lcls):
            return lcls
        else:
            return glbs
