def _ofind(self, oname, namespaces=None):
    'Find an object in the available namespaces.\n\n        self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic\n\n        Has special code to detect magic functions.\n        '
    oname = oname.strip()
    if ((not oname.startswith(ESC_MAGIC)) and (not oname.startswith(ESC_MAGIC2)) and (not all((a.isidentifier() for a in oname.split('.'))))):
        return {'found': False}
    if (namespaces is None):
        namespaces = [('Interactive', self.user_ns), ('Interactive (global)', self.user_global_ns), ('Python builtin', builtin_mod.__dict__)]
    ismagic = False
    isalias = False
    found = False
    ospace = None
    parent = None
    obj = None
    oname_parts = oname.split('.')
    (oname_head, oname_rest) = (oname_parts[0], oname_parts[1:])
    for (nsname, ns) in namespaces:
        try:
            obj = ns[oname_head]
        except KeyError:
            continue
        else:
            for (idx, part) in enumerate(oname_rest):
                try:
                    parent = obj
                    if (idx == (len(oname_rest) - 1)):
                        obj = self._getattr_property(obj, part)
                    else:
                        obj = getattr(obj, part)
                except:
                    break
            else:
                found = True
                ospace = nsname
                break
    if (not found):
        obj = None
        if oname.startswith(ESC_MAGIC2):
            oname = oname.lstrip(ESC_MAGIC2)
            obj = self.find_cell_magic(oname)
        elif oname.startswith(ESC_MAGIC):
            oname = oname.lstrip(ESC_MAGIC)
            obj = self.find_line_magic(oname)
        else:
            obj = self.find_line_magic(oname)
            if (obj is None):
                obj = self.find_cell_magic(oname)
        if (obj is not None):
            found = True
            ospace = 'IPython internal'
            ismagic = True
            isalias = isinstance(obj, Alias)
    if ((not found) and (oname_head in ["''", '""', '[]', '{}', '()'])):
        obj = eval(oname_head)
        found = True
        ospace = 'Interactive'
    return {'obj': obj, 'found': found, 'parent': parent, 'ismagic': ismagic, 'isalias': isalias, 'namespace': ospace}
Find an object in the available namespaces.

self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic

Has special code to detect magic functions.
def _ofind(self, oname, namespaces=None):
    'Find an object in the available namespaces.\n\n        self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic\n\n        Has special code to detect magic functions.\n        '
    oname = oname.strip()
    if ((not oname.startswith(ESC_MAGIC)) and (not oname.startswith(ESC_MAGIC2)) and (not all((a.isidentifier() for a in oname.split('.'))))):
        return {'found': False}
    if (namespaces is None):
        namespaces = [('Interactive', self.user_ns), ('Interactive (global)', self.user_global_ns), ('Python builtin', builtin_mod.__dict__)]
    ismagic = False
    isalias = False
    found = False
    ospace = None
    parent = None
    obj = None
    oname_parts = oname.split('.')
    (oname_head, oname_rest) = (oname_parts[0], oname_parts[1:])
    for (nsname, ns) in namespaces:
        try:
            obj = ns[oname_head]
        except KeyError:
            continue
        else:
            for (idx, part) in enumerate(oname_rest):
                try:
                    parent = obj
                    if (idx == (len(oname_rest) - 1)):
                        obj = self._getattr_property(obj, part)
                    else:
                        obj = getattr(obj, part)
                except:
                    break
            else:
                found = True
                ospace = nsname
                break
    if (not found):
        obj = None
        if oname.startswith(ESC_MAGIC2):
            oname = oname.lstrip(ESC_MAGIC2)
            obj = self.find_cell_magic(oname)
        elif oname.startswith(ESC_MAGIC):
            oname = oname.lstrip(ESC_MAGIC)
            obj = self.find_line_magic(oname)
        else:
            obj = self.find_line_magic(oname)
            if (obj is None):
                obj = self.find_cell_magic(oname)
        if (obj is not None):
            found = True
            ospace = 'IPython internal'
            ismagic = True
            isalias = isinstance(obj, Alias)
    if ((not found) and (oname_head in [, '', '[]', '{}', '()'])):
        obj = eval(oname_head)
        found = True
        ospace = 'Interactive'
    return {'obj': obj, 'found': found, 'parent': parent, 'ismagic': ismagic, 'isalias': isalias, 'namespace': ospace}