def is_hex_digits(entry, count):
 try:
  if (len(entry) != count):
   return False
  int(entry, 16)
  return True
 except (ValueError, TypeError):
  return False

def is_hex_digits ( entry , count ) : try : if ( len ( entry ) != count ) : return False int ( entry , 16 ) return True except ( ValueError , TypeError ) : return False
checks if a string is the given number of hex digits .