Convert/round a :cls:`timedelta` to an integral number of minutes.

    If ``strict`` is true than raises :exc:`ValueError` if the
    :cls:`~datetime.timedelta` is not a integral multiple of 60 seconds.

def timedelta_total_minutes(td, strict=False):
    """ Convert/round a :cls:`timedelta` to an integral number of minutes.

    If ``strict`` is true than raises :exc:`ValueError` if the
    :cls:`~datetime.timedelta` is not a integral multiple of 60 seconds.

    """
    minutes, seconds = divmod(td.days * 24 * 3600 + td.seconds, 60)
    if seconds or td.microseconds:
        if strict:
            raise ValueError(
                "%r is not an integral multiple of 60 seconds", td)
        if seconds > 30 or (seconds == 30 and td.microseconds > 0):
            minutes += 1
    return minutes