<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def apply_configs(config):
 """ Configures components. They can be enabled or disabled, have timeouts set if applicable, and have metadata customized. Valid keys are name, enabled, metadata, and timeout. Args: config (list):
 a list of dictionaries with the following keys: default_component_enabled (bool):
 default value for whether compoments are enable if not specifically declared in the config section packages (list):
 a list of packages to be loaded. These will be in addition to any packages previosly loaded for the `-p` option configs: name, enabled, metadata, and timeout. All keys are optional except name. name is the prefix or exact name of any loaded component. Any component starting with name will have the associated configuration applied. enabled is whether the matching components will execute even if their dependencies are met. Defaults to True. timeout sets the class level timeout attribute of any component so long as the attribute already exists. metadata is any dictionary that you want to attach to the component. The dictionary can be retrieved by the component at runtime. """

    default_enabled = config.get('default_component_enabled', False)
    delegate_keys = sorted(dr.DELEGATES, key=dr.get_name)
    for comp_cfg in config.get('configs', []):
        name = comp_cfg.get("name")
        for c in delegate_keys:
            delegate = dr.DELEGATES[c]
            cname = dr.get_name(c)
            if cname.startswith(name):
                dr.ENABLED[c] = comp_cfg.get("enabled", default_enabled)
                delegate.metadata.update(comp_cfg.get("metadata", {}))
                delegate.tags = set(comp_cfg.get("tags", delegate.tags))
                for k, v in delegate.metadata.items():
                    if hasattr(c, k):
                        log.debug("Setting %s.%s to %s", cname, k, v)
                        setattr(c, k, v)
                if hasattr(c, "timeout"):
                    c.timeout = comp_cfg.get("timeout", c.timeout)
            if cname == name:
                break