def has_value(key, value=None):
    '''
    Determine whether the key exists in the current salt process
    environment dictionary. Optionally compare the current value
    of the environment against the supplied value string.

    key
        Must be a string. Used as key for environment lookup.

    value:
        Optional. If key exists in the environment, compare the
        current value with this value. Return True if they are equal.

    CLI Example:

    .. code-block:: bash

        salt '*' environ.has_value foo
    '''
    if not isinstance(key, six.string_types):
        log.debug(
            '{0}: \'key\' argument is not a string type: \'{1}\''
            .format(__name__, key)
        )
        return False
    try:
        cur_val = os.environ[key]
        if value is not None:
            if cur_val == value:
                return True
            else:
                return False
    except __HOLE__:
        return False
    return True
dataset/ETHPy150Open saltstack/salt/salt/modules/environ.py/has_value