def ishex(obj):
    """
    Tests if the argument is a string representing a valid hexadecimal digit

    :param obj: Object
    :type  obj: any

    :rtype: boolean
    """
    return isinstance(obj, str) and len(obj) == 1 and obj.upper(
        ) in '0123456789ABCDEF'
