code: def ToScriptHash(data, unhex=True):
          
          if len(data) > 1 and unhex:
              data = binascii.unhexlify(data)
          return UInt160(data=binascii.unhexlify(bytes(Crypto.Hash160(data), encoding='utf-8')))
docs: Get a script hash of the data.
  
          Args:
              data (bytes): data to hash.
              unhex (bool): (Default) True. Set to unhexlify the stream. Use when the bytes are not raw bytes; i.e. b'aabb'
  
          Returns:
              UInt160: script hash.