def METHOD_NAME(self, encoding):
    encoding_line = "# coding={0}".format(encoding)
    assert CODING_RE.match(encoding_line)
    source_lines = [encoding_line.encode('utf-8')]
    source_lines.append(self.source_line.encode(encoding))
    return b'\n'.join(source_lines)