def get_list(env, name, default=None):
    """Get a list from the environment

    The input is assumed to be a comma-separated list of strings.

    If ``name`` is not found in ``env``, return ``default``. Note
    that ``default`` is returned as-is, so you should usually specify it as a
    list::

        ALLOWED_HOSTS = get_list(os.environ, 'ALLOWED_HOSTS', ['localhost', ])
    """
    if default is None:
        default = []
    if name not in env:
        return default
    return env[name].split(',')