def clean_lines(commands):
    if isinstance(commands, basestring):
        if path.isfile(commands):
            commands = open(commands, 'rb')
        elif len(commands.split(',')) > 1:
            commands = commands.split(',')
        else:
            try:
                if commands.strip()[0] != "
                    yield commands.strip() + '\n'
                    return
            except IndexError:
                pass
    elif isinstance(commands, list):
        pass
    else:
        raise TypeError('clean_lines() accepts a \'str\' or \'list\'')
    for cmd in commands:
        try:
            if cmd.strip()[0] != "
                yield cmd.strip() + '\n'
        except IndexError:
            pass