def complete_identifier(cmd, prefix):
if not cmd.proc.curframe: return [None]<EOL>ns = cmd.proc.curframe.f_globals.copy()<EOL>ns.update(cmd.proc.curframe.f_locals)<EOL>if '<STR_LIT:.>' in prefix:<EOL><INDENT>dotted = prefix.split('<STR_LIT:.>')<EOL>try:<EOL><INDENT>obj = ns[dotted[<NUM_LIT:0>]]<EOL>for part in dotted[<NUM_LIT:1>:-<NUM_LIT:1>]:<EOL><INDENT>obj = getattr(obj, part)<EOL><DEDENT><DEDENT>except (KeyError, AttributeError):<EOL><INDENT>return []<EOL><DEDENT>pre_prefix = '<STR_LIT:.>'.join(dotted[:-<NUM_LIT:1>]) + '<STR_LIT:.>'<EOL>return [pre_prefix + n for n in dir(obj) if<EOL>n.startswith(dotted[-<NUM_LIT:1>])]<EOL><DEDENT>else:<EOL><INDENT>return Mcomplete.complete_token(ns.keys(), prefix)<EOL><DEDENT>
Complete an arbitrary expression.