code: def set_permission(self, permission, value, parent=False, admin=False):
          
          try:
              if not getattr(self, 'parent_{}'.format(permission)) and not parent and not admin:
                  return False
              level = 'parent' if parent else 'self'
              setattr(self, '{}_{}'.format(level, permission), value)
  
              # Set student permission to false if parent sets permission to false.
              if parent and not value:
                  setattr(self, 'self_{}'.format(permission), False)
  
              self.save()
              return True
          except Exception as e:
              logger.error("Error occurred setting permission {} to {}: {}".format(permission, value, e))
              return False
docs: Sets permission for personal information.
              Returns False silently if unable to set permission.
              Returns True if successful.