code: def InputSeries(allowed_hero_series_types):
      """
      Check if first argument of function has / fulfills
      type allowed_hero_series_type
      Examples
      --------
      >>> from texthero._types import *
      >>> import pandas as pd
      >>> @InputSeries(TokenSeries)
      ... def f(s):
      ...     pass
      >>> f(pd.Series("Not tokenized")) # doctest: +SKIP
      >>> # throws a type error with a nice explaination
      >>> f(pd.Series([["I", "am", "tokenized"]]))
      >>> # passes
      With several possible types:
  
      >>> @InputSeries([DataFrame, VectorSeries])
      ... def g(x):
      ...     pass
      """
  
      def decorator(func):
          @functools.wraps(func)
          def wrapper(*args, **kwargs):
              s = args[0]  # The first input argument will be checked.
              # Check if input series can fulfill type.
  
              # list -> several possible types
              if isinstance(allowed_hero_series_types, list):
                  # Output of check_type is always Bool, Error_String where the Bool is True
                  # if the type is fulfilled, else false.
                  # if no type is fulfilled (so check_type first output is False for all allowed types),
                  # combine all the error strings to show the user all allowed types in the TypeError.
                  if not any(
                      allowed_type.check_type(s)[0]
                      for allowed_type in allowed_hero_series_types
                  ):
                      error_string = (
                          "Possible types:\n\nEither "
                          + allowed_hero_series_types[0].check_type(s)[
                              1
                          ]
                      )
  
                      for allowed_type in allowed_hero_series_types[1:]:
                          error_string += (
                              "\n\nOr " + allowed_type.check_type(s)[1]
                          )
  
                      raise TypeError(error_string)
  
              else:  # only one possible type
                  (
                      fulfills,
                      error_string,
                  ) = allowed_hero_series_types.check_type(s)
                  if not fulfills:
                      raise TypeError(error_string)
  
              # If we get here, the type can be fulfilled -> execute function as usual.
              return func(*args, **kwargs)
  
          return wrapper
  
      return decorator
  
file_path: texthero/texthero/_types.py
imports: import functools
  import pandas
  from typing import Tuple
label_desc: Use image node_id 1 for calling a global function with example usage: InputSeries(allowed_hero_series_types) and returns: decorator, wrapper, func