def overlaps(when, spans):
    """
    Checks an overlap of a datetime with list of datetime spans.
    """
    for start, stop in spans:
        if start <= when <= stop:
            return True
    return False