code: def handle_type_error(fn):
      
      @wraps(fn)
      def handle_type_error_wrapper(*args, **kwargs):
          def any_match(string_list, obj):
              return filter(lambda x: x in obj, string_list)
  
          try:
              return fn(*args, **kwargs)
          except TypeError as e:
              message = e.__str__()
              str_list = [
                  "takes exactly",
                  "got an unexpected",
                  "takes no argument",
              ]
              if fn.__name__ in message and any_match(str_list, message):
                  raise HTTPError(400, message)
  
              raise  # This will cause 500: Internal server error
  
      return handle_type_error_wrapper
docs: Convert ``TypeError`` to ``bottle.HTTPError`` with ``400`` code and message
      about wrong parameters.
  
      Raises:
          HTTPError: 400 in case too many/too little function parameters were \
                     given.