code: def get_privacy_options(user):
      
  
      privacy_options = {}
  
      for ptype in user.permissions:
          for field in user.permissions[ptype]:
              if ptype == "self":
                  privacy_options["{}-{}".format(field, ptype)] = user.permissions[ptype][field]
              else:
                  privacy_options[field] = user.permissions[ptype][field]
  
      return privacy_options
docs: Get a user's privacy options to pass as an initial value to a PrivacyOptionsForm.