<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def resolve(config, default_name = None):
 """ Resolves a component name from configuration parameters. The name can be stored in "id", "name" fields or inside a component descriptor. If name cannot be determined it returns a defaultName. :param config: configuration parameters that may contain a component name. :param default_name: (optional) a default component name. :return: resolved name or default name if the name cannot be determined. """

        name = config.get_as_nullable_string("name")
        name = name if name != None else config.get_as_nullable_string("id")

        if name == None:
            descriptor_str = config.get_as_nullable_string("descriptor")
            descriptor = Descriptor.from_string(descriptor_str)
            if descriptor != None:
                name = descriptor.get_name()

        return name if name != None else default_name