<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_config(config):
 """Save configuration file to users data location. - Linux: ~/.local/share/pyfilemail - OSX: ~/Library/Application Support/pyfilemail - Windows: C:\\\Users\\\{username}\\\AppData\\\Local\\\pyfilemail :rtype: str """


    configfile = get_configfile()

    if not os.path.exists(configfile):
        configdir = os.path.dirname(configfile)

        if not os.path.exists(configdir):
            os.makedirs(configdir)

    data = config

    with open(configfile, 'wb') as f:
        json.dump(data, f, indent=2)