code: def _validate_entity(entity):
      '''
      Validates the entity dict representation
  
      entity
          Dictionary representation of an entity.
          See ``_get_entity`` docstrings for format.
      '''
  
      #Validate entity:
      if entity['type'] == 'cluster':
          schema = ESXClusterEntitySchema.serialize()
      elif entity['type'] == 'vcenter':
          schema = VCenterEntitySchema.serialize()
      else:
          raise ArgumentValueError('Unsupported entity type \'{0}\''
                                   ''.format(entity['type']))
      try:
          jsonschema.validate(entity, schema)
      except jsonschema.exceptions.ValidationError as exc:
          raise InvalidEntityError(excf _validate_entity(entity):
      '''
      Validates the entity dict representation
  
      entity
          Dictionary representation of an entity.
          See ``_get_entity`` docstrings for format.
      '''
  
      #Validate entity:
      if entity['type'] == 'cluster':
          schema = ESXClusterEntitySchema.serialize()
      elif entity['type'] == 'vcenter':
          schema = VCenterEntitySchema.serialize()
      else:
          raise ArgumentValueError('Unsupported entity type \'{0}\''
                                   ''.format(entity['type']))
      try:
          jsonschema.validate(entity, schema)
      except jsonschema.exceptions.ValidationError as exc:
          raise InvalidEntityError(exc)
docs: Validates the entity dict representation
  
      entity
          Dictionary representation of an entity.
          See ``_get_entity`` docstrings for format.