code: def validate(cls, mapper_spec):
      
      if mapper_spec.input_reader_class() != cls:
        raise BadReaderParamsError("Input reader class mismatch")
      params = _get_params(mapper_spec)
      if cls.BATCH_SIZE_PARAM in params:
        try:
          batch_size = int(params[cls.BATCH_SIZE_PARAM])
          if batch_size < 1:
            raise BadReaderParamsError("Bad batch size: %s" % batch_size)
        except ValueError, e:
          raise BadReaderParamsError("Bad batch size: %s" % e)
docs: Validates mapper spec.
  
      Args:
        mapper_spec: The MapperSpec for this InputReader.
  
      Raises:
        BadReaderParamsError: required parameters are missing or invalid.