def int_to_hex_str(value, length=2):
    """
    Convert an integer to a hex string.

    Args:
        value  (int): The value to be converted
        length (int): The number of characters of the output string. Default: 2
    """

    # Make sure 'length' is of even length
    if length % 2 != 0: length += 1

    # Generate the format string
    format_string = "%0" + str(length) + "X"

    # Return hex string
    return format_string % value