import importlib


def load_component(component, name, class_name):
    """Load and return component network from file."""
    imported = importlib.import_module(
        '.'.join(('musegan.presets', component, name)))
    return getattr(imported, class_name)