import time


def is_time_around(expected_time, loop=None, delta=.01):
    """
    Checks that the time is equal to ``expected_time`` (within the range of +/-
    ``delta``).

    If ``loop`` is provided, the clock of the loop is used.
    """
    now = loop.time() if loop else time.time()
    return (expected_time - delta) <= now <= (expected_time + delta)