code: def FromString(val):
          
          # first, check if the value supplied is the string literal of the enum (e.g. "String")
  
          if isinstance(val, bytes):
              val = val.decode('utf-8')
  
          try:
              return ContractParameterType[val]
          except Exception as e:
              # ignore a KeyError if the val isn't found in the Enum
              pass
  
          # second, check if the value supplied is bytes or hex-encoded (e.g. b'07')
          try:
              if isinstance(val, (bytearray, bytes)):
                  int_val = int.from_bytes(val, 'little')
              else:
                  int_val = int.from_bytes(binascii.unhexlify(val), 'little')
          except (binascii.Error, TypeError) as e:
              # if it's not hex-encoded, then convert as int (e.g. "7" or 7)
              int_val = int(val)
  
          return ContractParameterType(int_val)
docs: Create a ContractParameterType object from a str
  
          Args:
              val (str): the value to be converted to a ContractParameterType.
              val can be hex encoded (b'07'), int (7), string int ("7"), or string literal ("String")
  
          Returns:
              ContractParameterType