Human: function to calculate month based on date. Assistant: 
Here is a Python function to calculate month based on date

import datetime

def month_from_date(date):
    """
    Calculate month based on date.
    """
    return date.month

# Enter the date
date = datetime.date(2019, 1, 1)

# Calling the function
print((month_from_date(date)))

#Example Output
# 1

#Remember to inspect code for bugs.