  def SetOrgPolicy(
      self, resource: str, policy: Dict[str, Any],
      etag: Optional[str] = None) -> Dict[str, Any]:
    """Updates the specified Policy on the resource.
    Creates a new Policy for that Constraint on the resource if one does
    not exist.
    

    Args:
      resource (str): a resource identifier in the format
        resource_type/resource_number e.g. projects/123456789012 where
        project_type is one of projects, folders or organizations.
      policy (dict): The policy to create, as per
        https://cloud.google.com/resource-manager/reference/rest/v1/Policy
      etag (str): The current version, for concurrency control.
        Not supplying an etag on the request Policy results in an unconditional
        write of the Policy.

    Returns:
      Dict[str, Any]: The Org Policy that was created.
        https://cloud.google.com/resource-manager/reference/rest/v1/Policy

    Raises:
      TypeError: if an invalid resource type is provided.
    """
    resource_type = resource.split('/')[0]
    if resource_type not in self.RESOURCE_TYPES:
      raise TypeError('Invalid resource type "{0:s}", resource must be one of '
          '"projects", "folders" or "organizations" provided in the format '
          '"resource_type/resource_number".'.format(resource))

    # Override API version, since this doesn't exist in v2 or v3
    self.RESOURCE_MANAGER_API_VERSION = 'v1'
    service = self.GrmApi()
    resource_client = getattr(service, resource_type)()
    body = {'policy': policy}
    if etag:
      body['policy']['etag'] = etag
    response: Dict[str, Any] = resource_client.setOrgPolicy(resource=resource,
                                            body=body).execute()
    return response
Updates the specified Policy on the resource.
Creates a new Policy for that Constraint on the resource if one does
not exist.


Args:
resource (str): a resource identifier in the format
resource_type/resource_number e.g. projects/123456789012 where
project_type is one of projects, folders or organizations.
policy (dict): The policy to create, as per
https://cloud.google.com/resource-manager/reference/rest/v1/Policy
etag (str): The current version, for concurrency control.
Not supplying an etag on the request Policy results in an unconditional
write of the Policy.

Returns:
Dict[str, Any]: The Org Policy that was created.
https://cloud.google.com/resource-manager/reference/rest/v1/Policy

Raises:
TypeError: if an invalid resource type is provided.
libcloudforensics/providers/gcp/internal/cloudresourcemanager.py