Convert a protobuf module to a dict of generators.

    This is typically used with modules that contain multiple type definitions.

def _module_to_generators(pb_module):
    '''
    Convert a protobuf module to a dict of generators.

    This is typically used with modules that contain multiple type definitions.
    '''
    if not pb_module:
        return None
    message_types = pb_module.DESCRIPTOR.message_types_by_name
    return {k: ProtobufGenerator(v) for k, v in message_types.items()}