code: def set_permissions(filename, uid=None, gid=None, mode=0775):
      
      if uid is None:
          uid = get_ftp_uid()
  
      if gid is None:
          gid = -1
  
      os.chown(filename, uid, gid)
      os.chmod(filename, mode)
docs: Set pemissions for given `filename`.
  
      Args:
          filename (str): name of the file/directory
          uid (int, default proftpd): user ID - if not set, user ID of `proftpd`
                                      is used
          gid (int): group ID, if not set, it is not changed
          mode (int, default 0775): unix access mode