def is_weekend(tx_datetime):
    """
    This function checks if a date falls on weekend.

    Args:
        tx_datetime: Datetime variable

    Returns:
        0 - date falls on weekday, 1 - date falls on weekend
    """

    # Transform date into weekday (0 is Monday, 6 is Sunday)
    weekday = tx_datetime.weekday()
    # Binary value: 0 if weekday, 1 if weekend
    is_weekend = weekday >= 5

    return int(is_weekend)