code: function (CurrentEntity) {
    return function (entity) {
      expect(arguments).to.have.length(
        1,
        'Invalid arguments length when getting an Entity specialization (it ' +
        'has to be passed 1 argument)'
      );
  
      expect(entity).to.be.a(
        'string',
        'Invalid argument when creating a new Entity function (it has to be ' +
        'a string'
      );
  
      var entities = CurrentEntity.specializations;
  
      try {
        expect(entities).to.have.ownProperty(entity);
      } catch (e) {
        throw new errors.EntityNotFoundError(
          entity,
          e
        );
      }
  
      return entities[entity];
    };
  }
docs: Private function used to get the getSpecialization function specific for the
  current Entity class.
  @name module:back4app-entity/models.Entity~_getGetSpecializationFunction
  @function
  @param {!Class} CurrentEntity The current entity class for which the new
  function will be created.
  @returns {Function} The new function.
  @private
  @example
  Entity.getSpecialization = _getGetSpecializationFunction(Entity);