<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_locale(lang):
 """Set the 'locale' used by a program. This affects the entire application, changing the way dates, currencies and numbers are represented. It should not be called from a library routine that may be used in another program. The ``lang`` parameter can be any string that is recognised by ``locale.setlocale()``, for example ``en``, ``en_GB`` or ``en_GB.UTF-8``. :param lang: language code. :type lang: string :return: success status. :rtype: bool """

    # get the default locale
    lc, encoding = locale.getdefaultlocale()
    try:
        if '.' in lang:
            locale.setlocale(locale.LC_ALL, lang)
        else:
            locale.setlocale(locale.LC_ALL, (lang, encoding))
    except locale.Error:
        return False
    return True