code: def factorial(n):
    
    if isinstance(n, float):
      if n.is_integer():
        n = int(n)
    if not isinstance(n, INT_TYPES):
      raise TypeError("Non-integer input (perhaps you need Euler Gamma "
                      "function or Gauss Pi function)")
    if n < 0:
      raise ValueError("Input shouldn't be negative")
    return reduce(operator.mul,
                  it.takewhile(lambda m: m <= n, it.count(2)),
                  1)
docs: Factorial function that works with really big numbers.