def deregister_sub(topics_to_subs, sub):
    """Deregister a Subscription from a mapping topics->subscriptions.

    Args:
        topics_to_subs (dict): dictionnary topic -> list of subscriptions
        sub (Subscription): subscription to deregister
    """
    key = str(sub.topics)
    if key in topics_to_subs:
        return topics_to_subs[str(sub.topics)].remove(sub)
    else:
        return topics_to_subs