from datetime import datetime


def get_state_by_time(python_time):
    """
    returns state for rule based on given time
    if given time is in the past returns 2 (withdrawed rule)
    else returns 1
    :param python_time:
    :return: integer rstate
    """
    present = datetime.now()

    if python_time <= present:
        return 2
    else:
        return 1