human
datetime get last month number.
assistant
Here is a Python function to datetime get last month number

import datetime

def get_last_month_number(dt):
    """Returns the last month number of a datetime object"""
    return dt.month - 1

# Enter the datetime object
dt = datetime.datetime(2019, 1, 1)

# Calling the function
print((get_last_month_number(dt)))

#Example Output
# 0

#Remember to inspect code for bugs.