<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _firefox_profile():
 """Configure the Firefox profile, respecting FIREFOX_PROFILE_PATH if set"""

    profile_dir = os.environ.get(FIREFOX_PROFILE_ENV_VAR)

    if profile_dir:
        LOGGER.info(u"Using firefox profile: %s", profile_dir)
        try:
            firefox_profile = webdriver.FirefoxProfile(profile_dir)
        except OSError as err:
            if err.errno == errno.ENOENT:
                raise BrowserConfigError(
                    u"Firefox profile directory {env_var}={profile_dir} does not exist".format(
                        env_var=FIREFOX_PROFILE_ENV_VAR, profile_dir=profile_dir))
            elif err.errno == errno.EACCES:
                raise BrowserConfigError(
                    u"Firefox profile directory {env_var}={profile_dir} has incorrect permissions. It must be \
                    readable and executable.".format(env_var=FIREFOX_PROFILE_ENV_VAR, profile_dir=profile_dir))
            else:
                # Some other OSError:
                raise BrowserConfigError(
                    u"Problem with firefox profile directory {env_var}={profile_dir}: {msg}"
                    .format(env_var=FIREFOX_PROFILE_ENV_VAR, profile_dir=profile_dir, msg=str(err)))
    else:
        LOGGER.info("Using default firefox profile")
        firefox_profile = webdriver.FirefoxProfile()

        # Bypasses the security prompt displayed by the browser when it attempts to
        # access a media device (e.g., a webcam)
        firefox_profile.set_preference('media.navigator.permission.disabled', True)

        # Disable the initial url fetch to 'learn more' from mozilla (so you don't have to
        # be online to run bok-choy on firefox)
        firefox_profile.set_preference('browser.startup.homepage', 'about:blank')
        firefox_profile.set_preference('startup.homepage_welcome_url', 'about:blank')
        firefox_profile.set_preference('startup.homepage_welcome_url.additional', 'about:blank')

        # Disable fetching an updated version of firefox
        firefox_profile.set_preference('app.update.enabled', False)

        # Disable plugin checking
        firefox_profile.set_preference('plugins.hide_infobar_for_outdated_plugin', True)

        # Disable health reporter
        firefox_profile.set_preference('datareporting.healthreport.service.enabled', False)

        # Disable all data upload (Telemetry and FHR)
        firefox_profile.set_preference('datareporting.policy.dataSubmissionEnabled', False)

        # Disable crash reporter
        firefox_profile.set_preference('toolkit.crashreporter.enabled', False)

        # Disable the JSON Viewer
        firefox_profile.set_preference('devtools.jsonview.enabled', False)

        # Grant OS focus to the launched browser so focus-related tests function correctly
        firefox_profile.set_preference('focusmanager.testmode', True)
    for function in FIREFOX_PROFILE_CUSTOMIZERS:
        function(firefox_profile)
    return firefox_profile