code: def getargspec(func):
      
      # noqa: E731 type: (Any) -> Any
      if inspect.ismethod(func):
          func = func.__func__
      parts = 0, ()  # noqa: E731 type: Tuple[int, Tuple[unicode, ...]]
      if type(func) is partial:
          keywords = func.keywords
          if keywords is None:
              keywords = {}
          parts = len(func.args), keywords.keys()
          func = func.func
      if not inspect.isfunction(func):
          raise TypeError('%r is not a Python function' % func)
      args, varargs, varkw = inspect.getargs(func.__code__)
      func_defaults = func.__defaults__
      if func_defaults is None:
          func_defaults = []
      else:
          func_defaults = list(func_defaults)
      if parts[0]:
          args = args[parts[0]:]
      if parts[1]:
          for arg in parts[1]:
              i = args.index(arg) - len(args)  # type: ignore
              del args[i]
              try:
                  del func_defaults[i]
              except IndexError:
                  pass
      return inspect.ArgSpec(args, varargs, varkw, func_defaults)
docs: Used because getargspec for python 2.7 does not accept functools.partial
      which is the type for pytest fixtures.
  
      getargspec excerpted from:
  
      sphinx.util.inspect
      ~~~~~~~~~~~~~~~~~~~
      Helpers for inspecting Python modules.
      :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
      :license: BSD, see LICENSE for details.
  
      Like inspect.getargspec but supports functools.partial as well.