def environment_from_config(config):
    """
    This functions returns either the environment of the current configuration.

    :param config: current configuration
    :return: 'staging' or 'production'
    """
    if hasattr(config, 'DEVICE_HOST') and 'test' in config.DEVICE_HOST:
        return 'staging'
    else:
        return 'production'
