code: def validate_signature(filename):
      
      out, err = back_tick(['codesign', '--verify', filename],
                           ret_err=True, as_str=True, raise_err=False)
      if not err:
          return # The existing signature is valid
      if 'code object is not signed at all' in err:
          return # File has no signature, and adding a new one isn't necessary
  
      # This file's signature is invalid and needs to be replaced
      replace_signature(filename, '-')
docs: Remove invalid signatures from a binary file
  
      If the file signature is missing or valid then it will be ignored
  
      Invalid signatures are replaced with an ad-hoc signature.  This is the
      closest you can get to removing a signature on MacOS
  
      Parameters
      ----------
      filename : str
          Filepath to a binary file