<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def tab_complete(string):
 """Finish file names "left short" by tab-completion For example, if an argument is "fred." and no file called "fred." exists but "fred.py" does exist then return fred.py """

    if is_option(string):
        return string
    if not missing_extension(string):
        return string
    if os.path.isfile(string):
        return string
    extended_files = [f for f in extend(string) if os.path.isfile(f)]
    try:
        return extended_files[0]
    except IndexError:
        return string