def normalize_delays(delays):
    """
    Normalizes a dictionary of channel delays. Postive delays shift right, negative delays shift left.
    Since we cannot delay by a negative amount in hardware, shift all delays until they are positive.
    Takes in a dict of channel:delay pairs and returns a normalized copy of the same.
    """
    out = dict(delays)
    if not out or len(out) == 0:
        import logging
        logging.error('normalize_delays() had no delays?')
        return out
    min_delay = min(delays.values())
    if min_delay < 0:
        for chan in delays.keys():
            out[chan] += -min_delay
    return out
