def hex_bw(val,hex_digits_width = 8 ):
    """ converts integer value into an hex string of fixed width """  
    
    assert( isinstance(val,int) )

    retstr = "{0:#0{1}x}".format(val,hex_digits_width+2)

    #  Explanation:
    # {   # Format identifier
    # 0:  # first parameter
    # #   # use "0x" prefix
    # 0   # fill with zeroes
    # {1} # to a length of n characters (including 0x), defined by the second parameter
    # x   # hexadecimal number, using lowercase letters for a-f
    # }   # End of format identifier

    # print(retstr)

    return(retstr)