<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def save_nk_object(obj, filename="file", path="", extension="nk", compress=False, compatibility=-1):
 """ Save whatever python object to a pickled file. Parameters file : object filename : str File's name. path : str File's path. extension : str File's extension. Default "nk" but can be whatever. compress: bool Enable compression using gzip. compatibility : int See :func:`pickle.dump`. Example Notes *Authors* - `Dominique Makowski <https://dominiquemakowski.github.io/>`_ *Dependencies* - pickle - gzip """

    if compress is True:
        with gzip.open(path + filename + "." + extension, 'wb') as name:
            pickle.dump(obj, name, protocol=compatibility)
    else:
        with open(path + filename + "." + extension, 'wb') as name:
            pickle.dump(obj, name, protocol=compatibility)