def METHOD_NAME(spec, factory_context):
    wrapped = AncestorLocationExpression.wrap(spec)
    wrapped.configure(
        ExpressionFactory.from_spec(wrapped.location_id, factory_context),
        ExpressionFactory.from_spec(wrapped.location_type, factory_context),
    )
    return wrapped