@classmethod
def factory(cls, registry):
    """Returns a dynamic MetricsHandler class tied
           to the passed registry.
        """
    cls_name = str(cls.__name__)
    MyMetricsHandler = type(cls_name, (cls, object), {'registry': registry})
    return MyMetricsHandler
