<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _set_factory_context(factory_class, bundle_context):
 # type: (type, Optional[BundleContext]) -> Optional[FactoryContext] """ Transforms the context data dictionary into its FactoryContext object form. :param factory_class: A manipulated class :param bundle_context: The class bundle context :return: The factory context, None on error """

    try:
        # Try to get the factory context (built using decorators)
        context = getattr(factory_class, constants.IPOPO_FACTORY_CONTEXT)
    except AttributeError:
        # The class has not been manipulated, or too badly
        return None

    if not context.completed:
        # Partial context (class not manipulated)
        return None

    # Associate the factory to the bundle context
    context.set_bundle_context(bundle_context)
    return context