<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_key(key, possible_keys, raise_error=True, name='formatoption keyword', msg=("See show_fmtkeys function for possible formatopion " "keywords"), *args, **kwargs):
 """ Checks whether the key is in a list of possible keys This function checks whether the given `key` is in `possible_keys` and if not looks for similar sounding keys Parameters key: str Key to check possible_keys: list of strings a list of possible keys to use raise_error: bool If not True, a list of similar keys is returned name: str The name of the key that shall be used in the error message msg: str The additional message that shall be used if no close match to key is found ``*args,**kwargs`` They are passed to the :func:`difflib.get_close_matches` function (i.e. `n` to increase the number of returned similar keys and `cutoff` to change the sensibility) Returns ------- str The `key` if it is a valid string, else an empty string list A list of similar formatoption strings (if found) str An error message which includes Raises ------ KeyError If the key is not a valid formatoption and `raise_error` is True"""

    if key not in possible_keys:
        similarkeys = get_close_matches(key, possible_keys, *args, **kwargs)
        if similarkeys:
            msg = ('Unknown %s %s! Possible similiar '
                   'frasings are %s.') % (name, key, ', '.join(similarkeys))
        else:
            msg = ("Unknown %s %s! ") % (name, key) + msg
        if not raise_error:
            return '', similarkeys, msg
        raise KeyError(msg)
    else:
        return key, [key], ''