from datetime import datetime


def get_weekseconds(dt):
    """Returns the number of seconds behind the most recent midnight of a Monday.

    For example: ``get_weekseconds(datetime(2016, 9, 12, 0, 5, 0)) => 300.0``.
    Because 2016-09-12 is a Monday, and 5 minutes is 300 seconds.
    """
    return (dt - datetime(1970, 1, 5)).total_seconds() % 604800