<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_penalty_model(specification):
 """Retrieve a PenaltyModel from one of the available factories. Args: specification (:class:`.Specification`):
 The specification for the desired PenaltyModel. Returns: :class:`.PenaltyModel`/None: A PenaltyModel as returned by the highest priority factory, or None if no factory could produce it. Raises: :exc:`ImpossiblePenaltyModel`: If the specification describes a penalty model that cannot be built by any factory. """


    # Iterate through the available factories until one gives a penalty model
    for factory in iter_factories():
        try:
            pm = factory(specification)
        except ImpossiblePenaltyModel as e:
            # information about impossible models should be propagated
            raise e
        except FactoryException:
            # any other type of factory exception, continue through the list
            continue

        # if penalty model was found, broadcast to all of the caches. This could be done
        # asynchronously
        for cache in iter_caches():
            cache(pm)

        return pm

    return None