<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_camera_panel(document_controller, panel_id, properties):
 """Create a custom camera panel. The camera panel type is specified in the 'camera_panel_type' key in the properties dict. The camera panel type must match a the 'camera_panel_type' of a camera panel factory in the Registry. The matching camera panel factory must return a ui_handler for the panel which is used to produce the UI. """

    camera_panel_type = properties.get("camera_panel_type")
    for component in Registry.get_components_by_type("camera_panel"):
        if component.camera_panel_type == camera_panel_type:
            hardware_source_id = properties["hardware_source_id"]
            hardware_source = HardwareSource.HardwareSourceManager().get_hardware_source_for_hardware_source_id(hardware_source_id)
            camera_device = getattr(hardware_source, "camera", None)
            camera_settings = getattr(hardware_source, "camera_settings", None)
            ui_handler = component.get_ui_handler(api_broker=PlugInManager.APIBroker(), event_loop=document_controller.event_loop, hardware_source_id=hardware_source_id, camera_device=camera_device, camera_settings=camera_settings)
            panel = Panel.Panel(document_controller, panel_id, properties)
            panel.widget = Declarative.DeclarativeWidget(document_controller.ui, document_controller.event_loop, ui_handler)
            return panel
    return None