'Helper to read a Slic3r configuration file'

def read_slic3r_config(self, configfile, parser=None):

    import ConfigParser
    parser = ConfigParser.RawConfigParser()
    class add_header(object, ):
        def __init__(self, f):
            self.f = f
            self.header = '[dummy]'
        def readline(self):
            if self.header:
                try:
                    return self.header
                finally:
                    self.header = None
            else:
                return self.f.readline()
    parser.readfp(add_header(open(configfile)), configfile)
    return parser
