code: def accept_kwargs(func):
      
      def wrapped(val, **kwargs):
          """Perform a function on a value, ignoring kwargs if necessary"""
          try:
              return func(val, **kwargs)
          except TypeError:
              return func(val)
      return wrapped
docs: Wrap a function that may not accept kwargs so they are accepted
  
      The output function will always have call signature of
      :code:`func(val, **kwargs)`, whereas the original function may have
      call signatures of :code:`func(val)` or :code:`func(val, **kwargs)`.
      In the case of the former, rather than erroring, kwargs are just
      ignored.
  
      This method is called on serializer/deserializer function; these
      functions always receive kwargs from serialize, but by using this,
      the original functions may simply take a single value.