<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(self, config_loc=None):
 """Saves current user credentials to user directory. Args: config_loc (str, optional):
 Location where credentials are to be stored. If no argument is provided, it will be send to the default location. Example: .. code:: from cartoframes import Credentials creds = Credentials(username='eschbacher', key='abcdefg') creds.save() # save to default location """

        if not os.path.exists(_USER_CONFIG_DIR):
            """create directory if not exists"""
            os.makedirs(_USER_CONFIG_DIR)
        with open(_DEFAULT_PATH, 'w') as f:
            json.dump({'key': self._key, 'base_url': self._base_url,
                       'username': self._username}, f)