'Encode the various kernel version strings (ex 2.6.20, 2.6.21-rc1,
2.7.30-rc2-git3, etc) in a way that makes them easily comparable using
lexicographic ordering.
:param version: kernel version string to encode
:return: processed kernel version string that can be compared using
lexicographic comparison'

@classmethod
def _kver_encode(cls, version):

    if ('rc' not in version):
        version += '-rc99'
    if ('git' not in version):
        version += '-git99'
    bits = cls._encode_sep.split(version)
    for n in range(0, len(bits), 2):
        if (len(bits[n]) < 2):
            bits[n] = ('0' + bits[n])
    return ''.join(bits)
