code: def is_hex_string(string):
      
      pattern = re.compile(r'[A-Fa-f0-9]+')
      if isinstance(string, six.binary_type):
          string = str(string)
      return pattern.match(string) is not None
docs: Check if the string is only composed of hex characters.