<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_env(key, default=None, coerce=lambda x: x, required=False):
 """ Return env var coerced into a type other than string. This function extends the standard os.getenv function to enable the coercion of values into data types other than string (all env vars are strings by default). Args: key: string, the name of the env var to look up Kwargs: default: the default value to return if the env var does not exist. NB the default value is **not** coerced, and is assumed to be of the correct type. coerce: a function that is used to coerce the value returned into another type required: bool, if True, then a RequiredSettingMissing error is raised if the env var does not exist. Returns the env var, passed through the coerce function """

    try:
        value = os.environ[key]
    except KeyError:
        if required is True:
            raise RequiredSettingMissing(key)
        else:
            return default

    try:
        return coerce(value)
    except Exception:
        raise CoercianError(key, value, coerce)