code: def create_or_update_entity(self, name, entity_id=None, metadata=None, policies=None, disabled=False,
                                  mount_point=DEFAULT_MOUNT_POINT):
          
          if metadata is None:
              metadata = {}
          if not isinstance(metadata, dict):
              error_msg = 'unsupported metadata argument provided "{arg}" ({arg_type}), required type: dict"'
              raise exceptions.ParamValidationError(error_msg.format(
                  arg=metadata,
                  arg_type=type(metadata),
              ))
          params = {
              'name': name,
              'metadata': metadata,
              'policies': policies,
              'disabled': disabled,
          }
          if entity_id is not None:
              params['id'] = entity_id
          api_path = '/v1/{mount_point}/entity'.format(mount_point=mount_point)
          response = self._adapter.post(
              url=api_path,
              json=params,
          )
          if response.status_code == 204:
              return response
          else:
              return response.json()
docs: Create or update an Entity.
  
          Supported methods:
              POST: /{mount_point}/entity. Produces: 200 application/json
  
          :param entity_id: ID of the entity. If set, updates the corresponding existing entity.
          :type entity_id: str | unicode
          :param name: Name of the entity.
          :type name: str | unicode
          :param metadata: Metadata to be associated with the entity.
          :type metadata: dict
          :param policies: Policies to be tied to the entity.
          :type policies: str | unicode
          :param disabled: Whether the entity is disabled. Disabled entities' associated tokens cannot be used, but are
              not revoked.
          :type disabled: bool
          :param mount_point: The "path" the method/backend was mounted on.
          :type mount_point: str | unicode
          :return: The JSON response for creates, the generic response object for updates, of the request.
          :rtype: dict | requests.Response