<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _parse_dnamasq(filename):
    '''
    Generic function for parsing dnsmasq files including includes.
    '''
    fileopts = {}

    if not os.path.isfile(filename):
        raise CommandExecutionError(
            'Error: No such file \'{0}\''.format(filename)
        )

    with salt.utils.files.fopen(filename, 'r') as fp_:
        for line in fp_:
            line = salt.utils.stringutils.to_unicode(line)
            if not line.strip():
                continue
            if line.startswith('#'):
                continue
            if '=' in line:
                comps = line.split('=')
                if comps[0] in fileopts:
                    if isinstance(fileopts[comps[0]], six.string_types):
                        temp = fileopts[comps[0]]
                        fileopts[comps[0]] = [temp]
                    fileopts[comps[0]].append(comps[1].strip())
                else:
                    fileopts[comps[0]] = comps[1].strip()
            else:
                if 'unparsed' not in fileopts:
                    fileopts['unparsed'] = []
                fileopts['unparsed'].append(line)
    return fileopts