def modevaltohex(mode_val):
    """ convert mode_val value that can be either xeh string or int to a hex string """
    if isinstance(mode_val, int):
        return (hex(mode_val)[2:]).upper()
    if isinstance(mode_val, str):
        return mode_val
    return None