code: def to_api_repr(self):
          
          resource = {self.entity_type: self.entity_id}
          if self.role is not None:
              resource["role"] = self.role
          return resource
docs: Construct the API resource representation of this access entry
  
          Returns:
              Dict[str, object]: Access entry represented as an API resource