def pymel_python_completer(self,event):
    """Match attributes or global python names"""
    #print "python_matches"
    text = event.symbol
    #print repr(text)
    # Another option, seems to work great. Catches things like ''.<tab>
    m = re.match(r"(\S+(\.\w+)*)\.(\w*)$", text)

    if not m:
        raise IPython.ipapi.TryNext

    expr, attr = m.group(1, 3)
    #print type(self.Completer), dir(self.Completer)
    #print self.Completer.namespace
    #print self.Completer.global_namespace
    try:
        #print "first"
        obj = eval(expr, self.Completer.namespace)
    except:
        try:
            #print "second"
            obj = eval(expr, self.Completer.global_namespace)
        except:
            raise IPython.ipapi.TryNext
    #print "complete"
    if isinstance(obj, (core.nt.DependNode, core.Attribute) ):
        #print "isinstance"
        node = unicode(obj)
        long_attrs = cmds.listAttr( node )
        short_attrs = cmds.listAttr( node , shortNames=1)

        matches = []
        matches = self.Completer.python_matches(text)
        #print "here"
        # if node is a plug  ( 'persp.t' ), the first result will be the passed plug
        if '.' in node:
            attrs = long_attrs[1:] + short_attrs[1:]
        else:
            attrs = long_attrs + short_attrs
        #print "returning"
        matches += [ expr + '.' + at for at in attrs ]
        #import colorize
        #matches = [ colorize.colorize(x,'magenta') for x in matches ]
        return matches

    raise IPython.ipapi.TryNext
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/tools/ipymel.py/pymel_python_completer/original