code: def hex2bin(hexstr):
      
      num_of_bits = len(hexstr) * 4
      binstr = bin(int(hexstr, 16))[2:].zfill(int(num_of_bits))
      return binstr
docs: Convert a hexdecimal string to binary string, with zero fillings.