code: def make_var_string(string):
      
      s = None
      if isinstance(string, str) and re.match('^[0-9a-fA-F]*$', string):
          # convert from hex to bin, safely
          s = binascii.unhexlify(string)
      else:
          s = string[:]
  
      buf = encoding.num_to_var_int(len(s)) + s
      return buf.encode('hex')
docs: Make a var-string (a var-int with the length, concatenated with the data)
      Return the hex-encoded string