Can you help me write a Python function to calculate factorials?