def find_payload_class(payload_type):
    '''Iterate through inherited classes to find a matching class name'''
    subclasses = set()
    work = [Payload]
    while work:
        parent_subclass = work.pop()
        for child_subclass in parent_subclass.__subclasses__():
            if child_subclass not in subclasses:
                if hasattr(child_subclass, 'payload_type') and child_subclass.payload_type == payload_type:
                    return child_subclass

                subclasses.add(child_subclass)
                work.append(child_subclass)

    return None
dataset/ETHPy150Open jessepeterson/commandment/commandment/profiles/__init__.py/find_payload_class/original