def can_set_locale(lc, lc_var=locale.LC_ALL):
try:<EOL><INDENT>with set_locale(lc, lc_var=lc_var):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>except (ValueError, locale.Error):<EOL><INDENT>return False<EOL><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT>
Check to see if we can set a locale, and subsequently get the locale,
without raising an Exception.

Parameters
----------
lc : str
    The locale to attempt to set.
lc_var : int, default `locale.LC_ALL`
    The category of the locale being set.

Returns
-------
is_valid : bool
    Whether the passed locale can be set