def fcomplete(text, state):
text = os.path.expanduser(text)<EOL>head, tail = os.path.split(text)<EOL>search_dir = os.path.join('<STR_LIT:.>', head)<EOL>candidates = [s for s in os.listdir(search_dir) if s.startswith(tail)]<EOL>if state >= len(candidates):<EOL><INDENT>return None<EOL><DEDENT>if len(candidates) == <NUM_LIT:1>:<EOL><INDENT>fn = os.path.join(head, candidates[<NUM_LIT:0>])<EOL>if not os.path.isdir(fn):<EOL><INDENT>return fn + '<STR_LIT:U+0020>'<EOL><DEDENT>return fn + '<STR_LIT:/>'<EOL><DEDENT>return os.path.join(head, candidates[state])<EOL>
Readline completion function: Filenames