code: def _adapt_param(self, key, val):
          
          if key in self.param_adapters:
              try:
                  return self.param_adapters[key](val)
              except (AdaptError, AdaptErrors, TypeError, ValueError) as e:
                  if hasattr(e, 'errors'):
                      errors = e.errors
                  else:
                      errors = [e]
  
                  raise AnticipateParamError(
                      message='Input value %r for parameter `%s` does not match '
                          'anticipated type %r' % (type(val), key, self.params[key]),
                      name=key,
                      value=val,
                      anticipated=self.params[key],
                      errors=errors)
          else:
              return val
docs: Adapt the value if an adapter is defined.