'Decode infile to unicode. Using the specified encoding.
if is a string, it also needs converting to a list.'

def _decode(self, infile, encoding):

    if isinstance(infile, six.string_types):
        return infile.splitlines(True)
    if isinstance(infile, six.binary_type):
        if encoding:
            return infile.decode(encoding).splitlines(True)
        else:
            return infile.splitlines(True)
    if encoding:
        for (i, line) in enumerate(infile):
            if isinstance(line, six.binary_type):
                infile[i] = line.decode(encoding)
    return infile
