docs: def request_parameter(parameter, parameter_type=None, default=None, optional=False):
      """Get a parameter from a request.
  
      parameter is the name of the parameter you are looking for
      parameter_type is the type the parameter should have
      default is the value the parameter takes if it has not been passed
  
      If the parameter is not found and no default is specified,
      or if the parameter is found but is of the wrong type
      then a Response object is returned
      """
      exp = Experiment(session)
  
      # get the parameter
      try:
          value = request.values[parameter]
      except KeyError:
          # if it isnt found use the default, or return an error Response
          if default is not None:
              return default
          elif optional:
              return None
          else:
              msg = "{} {} request, {} not specified".format(
                  request.url, request.method, parameter
              )
              return error_response(error_type=msg)
  
      # check the parameter type
      if parameter_type is None:
          # if no parameter_type is required, return the parameter as is
          return value
      elif parameter_type == "int":
          # if int is required, convert to an int
          try:
              value = int(value)
              return value
          except ValueError:
              msg = "{} {} request, non-numeric {}: {}".format(
                  request.url, request.method, parameter, value
              )
              return error_response(error_type=msg)
      elif parameter_type == "known_class":
          # if its a known class check against the known classes
          try:
              value = exp.known_classes[value]
              return value
          except KeyError:
              msg = "{} {} request, unknown_class: {} for parameter {}".format(
                  request.url, request.method, value, parameter
              )
              return error_response(error_type=msg)
      elif parameter_type == "bool":
          # if its a boolean, convert to a boolean
          if value in ["True", "False"]:
              return value == "True"
          else:
              msg = "{} {} request, non-boolean {}: {}".format(
                  request.url, request.method, parameter, value
              )
              return error_response(error_type=msg)
      else:
          msg = "/{} {} request, unknown parameter type: {} for parameter {}".format(
              request.url, request.method, parameter_type, parameter
          )
          return error_response(error_type=msg)