def version2number(s):
    """
    Translates a legible NIF version number to the packed-byte numeric representation. For example, "10.0.1.0" is translated to 0x0A000100.
    @param s: The version string to translate into numeric form.
    @type s: string
    @return The resulting numeric version of the given version string.
    @rtype: int
    """
    if not s: return None
    l = s.split('.')
    if len(l) > 4:
        assert(False)
        return int(s)
    
    if len(l) == 2:
        version = 0
        version += int(l[0]) << (3 * 8)
        if len(l[1]) >= 1:
            version += int(l[1][0]) << (2 * 8)
        if len(l[1]) >= 2:
            version += int(l[1][1]) << (1 * 8)
        if len(l[1]) >= 3:
            version += int(l[1][2:])
        return version
    else:
        version = 0
        for i in range(0, len(l)):
            version += int(l[i]) << ((3 - i) * 8)
            #return (int(l[0]) << 24) + (int(l[1]) << 16) + (int(l[2]) << 8) +
            #int(l[3])
        return version