code: def encode_type(primary_type, types):
      
      # Getting the dependencies and sorting them alphabetically as per EIP712
      deps = get_dependencies(primary_type, types)
      sorted_deps = (primary_type,) + tuple(sorted(deps))
  
      result = ''.join(
          [
              encode_struct(struct_name, types[struct_name])
              for struct_name in sorted_deps
          ]
      )
      return result
docs: The type of a struct is encoded as name ‖ "(" ‖ member₁ ‖ "," ‖ member₂ ‖ "," ‖ … ‖ memberₙ ")"
      where each member is written as type ‖ " " ‖ name.