<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sync_main(async_main, config_path=None, default_config=None, should_validate_task=True, loop_function=asyncio.get_event_loop):
 """Entry point for scripts using scriptworker. This function sets up the basic needs for a script to run. More specifically: * it creates the scriptworker context and initializes it with the provided config * the path to the config file is either taken from `config_path` or from `sys.argv[1]`. * it verifies `sys.argv` doesn't have more arguments than the config path. * it creates the asyncio event loop so that `async_main` can run Args: async_main (function):
 The function to call once everything is set up config_path (str, optional):
 The path to the file to load the config from. Loads from ``sys.argv[1]`` if ``None``. Defaults to None. default_config (dict, optional):
 the default config to use for ``_init_context``. defaults to None. should_validate_task (bool, optional):
 whether we should validate the task schema. Defaults to True. loop_function (function, optional):
 the function to call to get the event loop; here for testing purposes. Defaults to ``asyncio.get_event_loop``. """

    context = _init_context(config_path, default_config)
    _init_logging(context)
    if should_validate_task:
        validate_task_schema(context)
    loop = loop_function()
    loop.run_until_complete(_handle_asyncio_loop(async_main, context))