code: def file_signature(filename):
      
  
      if not os.path.isfile(filename):
          return None
      if not os.path.exists(filename):
          return None
  
      # Duplicate auto-generated files can be recognized with the sha1 hash.
      sig = hashlib.sha1()
      with open(filename, "rb") as f:
          buf = f.read()
          sig.update(buf)
  
      return sig.hexdigest()
docs: Return a signature for a file.