def _setup_firefox(driver_class, config=None, options=None, service=None, **kwargs):
    """
    Returns: selenium.webdriver.Firefox || selenium.webdriver.Remote
    """
    if config.user_agent is not None:
        options.set_preference("general.useragent.override", config.user_agent)

    if config.headless:
        options.add_argument("--headless")

    if config.incognito:
        options.add_argument("-private")

    if driver_class == Remote:
        rv = driver_class(options=options, **kwargs)
    else:
        rv = driver_class(options=options, service=service, **kwargs)

    if config.extensions:
        for extension in config.extensions:
            rv.install_addon(extension)

    if config.fullscreen:
        rv.fullscreen_window()

    return rv

    Returns: selenium.webdriver.Firefox || selenium.webdriver.Remote
    
splinter/driver/webdriver/setup.py