code: def matchuserhome(prefix):
          
          if not prefix.startswith('~'):
              raise ValueError("prefix must start with ~")
          try: import pwd
          except ImportError:
              try: import winpwd as pwd
              except ImportError: return []
          return ['~' + u[0] for u in pwd.getpwall() if u[0].startswith(prefix[1:])]
docs: To find matches that start with prefix.
          
          For example, if prefix = '~user' this
          returns list of possible matches in form of ['~userspam','~usereggs'] etc.
          
          matchuserdir('~') returns all users