def METHOD_NAME(component, module):
    # need this here for circular import
    from .. import potential as gala_potential
    try:
        class_name = component["class"]
    except KeyError:
        raise KeyError(
            "Potential dictionary must contain a key 'class' for "
            "specifying the name of the Potential class."
        )
    if "units" not in component:
        unitsys = None
    else:
        try:
            unitsys = [u.Unit(unit) for ptype, unit in component["units"].items()]
        except KeyError:
            raise KeyError(
                "Potential dictionary must contain a key 'units' "
                "with a list of strings specifying the unit system."
            )
    params = component.get("parameters", {})
    # need to crawl the dictionary structure and unpack quantities
    params = _unpack_params(params)
    if module is None:
        potential = gala_potential
    else:
        potential = module
    try:
        Potential = getattr(potential, class_name)
    except AttributeError:  # HACK: this might be bad to assume
        Potential = getattr(gala_potential, class_name)
    return Potential(units=unitsys, **params)