def get_hex(num, digits=2):
    """
    Convert an integer to a hex string of 'digit' characters.

    Args:
        num    (int): The value to be converted.
        digits (int): The number of characters the final string should comprise. Default: 2.

    Returns:
        str: The hex string.
    """

    format_str = "{:0" + str(digits) + "X}"
    return format_str.format(num)