'Uses the locale module to test the currently set locale
(per the LANG and LC_CTYPE environment settings)'

def _check_locale(self):

    try:
        locale.setlocale(locale.LC_ALL, '')
    except locale.Error:
        locale.setlocale(locale.LC_ALL, 'C')
        os.environ['LANG'] = 'C'
        os.environ['LC_ALL'] = 'C'
        os.environ['LC_MESSAGES'] = 'C'
    except Exception:
        e = get_exception()
        self.fail_json(msg=('An    unknown    error    was    encountered    while    attempting    to    validate    the    locale:    %s' % e))
