code: def tab_complete(string):
      
      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
docs: 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