nodes: 0, module; 1, function_definition; 2, function_name:lookup; 3, parameters; 4, block; 5, typed_parameter; 6, typed_parameter; 7, expression_statement; 8, try_statement; 9, identifier:source_id; 10, type; 11, identifier:schema_id; 12, type; 13, comment:"""
          Create a new schema object from an existing ledger schema
  
          :param source_id: Institution's personal identification for the schema
          :param schema_id: Ledger schema ID for lookup
          Example:
          source_id = 'foobar123'
          name = 'Address Schema'
          version = '1.0'
          attrs = ['address', 'city', 'state']
          payment_handle = 0
          schema1 = await Schema.create(source_id, name, version, attrs, payment_handle)
          id1 = await schema.get_schema_id()
          data = await Schema.lookup(source_id, schema_id)
          assert data.attrs.sort() == ['sex', 'age', 'name', 'height'].sort()
          assert data.name == 'test-licence'
          assert data.handle > 0
          :return: schema object
          """; 14, block; 15, except_clause; 16, identifier:str; 17, identifier:str; 18, expression_statement; 19, if_statement; 20, expression_statement; 21, expression_statement; 22, expression_statement; 23, expression_statement; 24, expression_statement; 25, expression_statement; 26, expression_statement; 27, expression_statement; 28, expression_statement; 29, return_statement; 30, identifier:KeyError; 31, block; 32, assignment; 33, not_operator; 34, block; 35, assignment; 36, assignment; 37, assignment; 38, call; 39, assignment; 40, assignment; 41, assignment; 42, assignment; 43, assignment; 44, identifier:schema; 45, raise_statement; 46, identifier:schema; 47, call; 48, call; 49, expression_statement; 50, expression_statement; 51, identifier:c_source_id; 52, call; 53, identifier:c_schema_id; 54, call; 55, pattern_list; 56, await; 57, attribute; 58, argument_list; 59, identifier:schema_result; 60, call; 61, attribute; 62, subscript; 63, attribute; 64, subscript; 65, attribute; 66, subscript; 67, attribute; 68, identifier:handle; 69, call; 70, identifier:Schema; 71, argument_list; 72, identifier:hasattr; 73, argument_list; 74, call; 75, assignment; 76, identifier:c_char_p; 77, argument_list; 78, identifier:c_char_p; 79, argument_list; 80, identifier:handle; 81, identifier:data; 82, call; 83, attribute; 84, identifier:debug; 85, string:"created schema object"; 86, attribute; 87, argument_list; 88, identifier:schema; 89, identifier:attrs; 90, identifier:schema_result; 91, string; 92, identifier:schema; 93, identifier:name; 94, identifier:schema_result; 95, string; 96, identifier:schema; 97, identifier:version; 98, identifier:schema_result; 99, string; 100, identifier:schema; 101, identifier:handle; 102, identifier:VcxError; 103, argument_list; 104, identifier:source_id; 105, string; 106, string; 107, list; 108, attribute; 109, string:"cb"; 110, attribute; 111, argument_list; 112, attribute; 113, call; 114, call; 115, call; 116, identifier:do_call; 117, argument_list; 118, identifier:schema; 119, identifier:logger; 120, identifier:json; 121, identifier:loads; 122, call; 123, string_content:data; 124, string_content:name; 125, string_content:version; 126, attribute; 127, identifier:Schema; 128, identifier:lookup; 129, attribute; 130, identifier:debug; 131, string:"vcx_schema_get_attributes: Creating callback"; 132, attribute; 133, identifier:cb; 134, identifier:create_cb; 135, argument_list; 136, attribute; 137, argument_list; 138, attribute; 139, argument_list; 140, string; 141, identifier:c_source_id; 142, identifier:c_schema_id; 143, attribute; 144, attribute; 145, argument_list; 146, identifier:ErrorCode; 147, identifier:InvalidSchema; 148, identifier:schema; 149, identifier:logger; 150, identifier:Schema; 151, identifier:lookup; 152, call; 153, identifier:source_id; 154, identifier:encode; 155, string; 156, identifier:schema_id; 157, identifier:encode; 158, string; 159, string_content:vcx_schema_get_attributes; 160, attribute; 161, identifier:cb; 162, identifier:data; 163, identifier:decode; 164, identifier:CFUNCTYPE; 165, argument_list; 166, string_content:utf-8; 167, string_content:utf-8; 168, identifier:Schema; 169, identifier:lookup; 170, None; 171, identifier:c_uint32; 172, identifier:c_uint32; 173, identifier:c_uint32; 174, identifier:c_char_p
code: async def lookup(source_id: str, schema_id: str):
          """
          Create a new schema object from an existing ledger schema
  
          :param source_id: Institution's personal identification for the schema
          :param schema_id: Ledger schema ID for lookup
          Example:
          source_id = 'foobar123'
          name = 'Address Schema'
          version = '1.0'
          attrs = ['address', 'city', 'state']
          payment_handle = 0
          schema1 = await Schema.create(source_id, name, version, attrs, payment_handle)
          id1 = await schema.get_schema_id()
          data = await Schema.lookup(source_id, schema_id)
          assert data.attrs.sort() == ['sex', 'age', 'name', 'height'].sort()
          assert data.name == 'test-licence'
          assert data.handle > 0
          :return: schema object
          """
          try:
              schema = Schema(source_id, '', '', [])
  
              if not hasattr(Schema.lookup, "cb"):
                  schema.logger.debug("vcx_schema_get_attributes: Creating callback")
                  Schema.lookup.cb = create_cb(CFUNCTYPE(None, c_uint32, c_uint32, c_uint32, c_char_p))
  
              c_source_id = c_char_p(source_id.encode('utf-8'))
              c_schema_id = c_char_p(schema_id.encode('utf-8'))
  
              handle, data = await do_call('vcx_schema_get_attributes',
                                           c_source_id,
                                           c_schema_id,
                                           Schema.lookup.cb)
              schema.logger.debug("created schema object")
  
              schema_result = json.loads(data.decode())
              schema.attrs = schema_result['data']
              schema.name = schema_result['name']
              schema.version = schema_result['version']
              schema.handle = handle
              return schema
          except KeyError:
              raise VcxError(ErrorCode.InvalidSchema)