import configparser


def configure(config_file='../docs/default_config.ini'):
    """
    Reads a configuration (INI format) file that specifies the three working
    directories for binary image files, as well as the preferred database
    connection.

    A configuration file should contain two sections: 

    1. A [directories] section that gives absolute paths to three directories:
    ingest_dir, an ingest directory, where one will ingest images from;
    data_dir, a data directory, where one will keep ingested binary image files;
    output_dir, an output directory, where one will ouput tarfiles to images.

    2. A [database] section that gives info to create a SQLAlchemy database URL.

    :config_file: path to configuration file
    :returns: configparser.ConfigParser() instance

    """

    configuration = configparser.ConfigParser()
    configuration.read(config_file)
    return configuration