import configparser
import os

config = configparser.ConfigParser()

def create_if_not_exists():
    """
    Create the config file if doesn't exist already.
    """

    # check if it exists
    if not os.path.exists(os.path.join(os.path.expanduser("~"), '.chubby')):
        os.chdir(os.path.expanduser("~"))
        # create file
        with open(".chubby", 'a'):
            pass

def read_config(config=config):
    """
    :returns:
        returns the config object.
    """
    create_if_not_exists()

    with open(os.path.join(os.path.expanduser("~"), ".chubby")) as f:
        config.read(f)
    return config

@@ -379,16 +379,100 @@
   pass%0A%0A
+def get_config_path():%0A    return os.path.join(os.path.expanduser(%22~%22), %22.chubby%22)%0A%0A
 def read
@@ -699,8 +699,730 @@
  config%0A
+%0Adef write_config(section_name: str,%0A                 section_content: dict):%0A    %22%22%22%0A    :param section_name:%0A        The name of the section to be written to the config file%0A    :param section_content:%0A        The keys and values to be written in the section passed as a dict.%0A    %22%22%22%0A    config = read_config()%0A%0A    # if present, modify%0A    if section_name in config:%0A        for keys in section_content:%0A            # if already present, overwrite%0A            if keys in config%5Bsection_name%5D:%0A                config%5Bsection_name%5D%5Bkeys%5D = section_content%5Bkeys%5D%0A    # else create a new section%0A    else:%0A        config%5Bsection_name%5D = section_content%0A%0A    with open(get_config_path(), 'w') as f:%0A        config.write(f)%0A

Add functionality to write to the config