a method to convert environment variables to a python dictionary

    :param model_path: [optional] string with path to jsonmodel of data to ingest
    :return: dictionary with environmental variables

    NOTE:   if a model is provided, then only those fields in the model will be
            added to the output and the value of any environment variable which
            matches the uppercase name of each field in the model will be added
            to the dictionary if its value is valid according to the model. if
            a value is not valid, the method will throw a InputValidationError

def ingest_environ(model_path=''):

    ''' a method to convert environment variables to a python dictionary

    :param model_path: [optional] string with path to jsonmodel of data to ingest
    :return: dictionary with environmental variables

    NOTE:   if a model is provided, then only those fields in the model will be
            added to the output and the value of any environment variable which
            matches the uppercase name of each field in the model will be added
            to the dictionary if its value is valid according to the model. if
            a value is not valid, the method will throw a InputValidationError
    '''

# convert environment variables into json typed data
    from os import environ, path
    typed_dict = {}
    environ_variables = dict(environ)
    for key, value in environ_variables.items():
        if value.lower() == 'true':
            typed_dict[key] = True
        elif value.lower() == 'false':
            typed_dict[key] = False
        elif value.lower() == 'null':
            typed_dict[key] = None
        elif value.lower() == 'none':
            typed_dict[key] = None
        else:
            try:
                try:
                    typed_dict[key] = int(value)
                except:
                    typed_dict[key] = float(value)
            except:
                typed_dict[key] = value

# feed environment variables through model
    if model_path:
        if not path.exists(model_path):
            raise ValueError('%s is not a valid file path.' % model_path)
        model_dict = load_settings(model_path)
        from jsonmodel.validators import jsonModel
        model_object = jsonModel(model_dict)
        default_dict = model_object.ingest(**{})
        for key in default_dict.keys():
            if key.upper() in typed_dict:
                valid_kwargs = {
                    'input_data': typed_dict[key.upper()],
                    'object_title': 'Environment variable %s' % key.upper(),
                    'path_to_root': '.%s' % key
                }
                default_dict[key] = model_object.validate(**valid_kwargs)
        return default_dict

    return typed_dict