nodes: 0, module; 1, function_definition; 2, function_name:set_python; 3, parameters; 4, block; 5, identifier:self; 6, identifier:value; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, expression_statement; 14, return_statement; 15, comment:"""Expect list of record instances, convert to a SortedDict for internal representation"""; 16, not_operator; 17, block; 18, assignment; 19, assignment; 20, identifier:record; 21, identifier:value; 22, block; 23, assignment; 24, assignment; 25, identifier:return_value; 26, attribute; 27, if_statement; 28, identifier:value; 29, boolean_operator; 30, identifier:records; 31, call; 32, expression_statement; 33, expression_statement; 34, identifier:return_value; 35, call; 36, subscript; 37, call; 38, identifier:self; 39, identifier:multiselect; 40, boolean_operator; 41, block; 42, identifier:value; 43, list; 44, identifier:SortedDict; 45, argument_list; 46, call; 47, assignment; 48, attribute; 49, argument_list; 50, subscript; 51, attribute; 52, attribute; 53, argument_list; 54, identifier:value; 55, not_operator; 56, expression_statement; 57, attribute; 58, argument_list; 59, subscript; 60, identifier:record; 61, identifier:self; 62, identifier:_set; 63, identifier:records; 64, attribute; 65, string; 66, identifier:self; 67, identifier:id; 68, identifier:self; 69, identifier:get_swimlane; 70, call; 71, assignment; 72, identifier:self; 73, identifier:validate_value; 74, identifier:record; 75, identifier:records; 76, attribute; 77, attribute; 78, identifier:_raw; 79, string_content:values; 80, identifier:isinstance; 81, argument_list; 82, identifier:value; 83, list; 84, identifier:record; 85, identifier:id; 86, identifier:self; 87, identifier:record; 88, identifier:value; 89, identifier:list; 90, identifier:value
code: def set_python(self, value):
          """Expect list of record instances, convert to a SortedDict for internal representation"""
          if not self.multiselect:
              if value and not isinstance(value, list):
                  value = [value]
  
          value = value or []
  
          records = SortedDict()
  
          for record in value:
              self.validate_value(record)
              records[record.id] = record
  
          return_value = self._set(records)
          self.record._raw['values'][self.id] = self.get_swimlane()
  
          return return_value