Factorial function implementation in Python.
Implement factorial(n) for a non-negative integer n. Return the product of every integer from 1 through n, with 0! defined as 1.
Function signature: def factorial(n):
The function must return a Python integer and may assume that all inputs satisfy the stated constraints.
def factorial(n):