nodes: 0, module; 1, function_definition; 2, function_name:get_sorted_attachments; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, function_definition; 11, expression_statement; 12, return_statement; 13, comment:"""Returns a sorted list of analysis info dictionaries
          """; 14, assignment; 15, assignment; 16, assignment; 17, function_name:att_cmp; 18, parameters; 19, block; 20, assignment; 21, identifier:sorted_attachments; 22, identifier:inf; 23, call; 24, identifier:order; 25, call; 26, identifier:attachments; 27, call; 28, identifier:att1; 29, identifier:att2; 30, expression_statement; 31, expression_statement; 32, expression_statement; 33, expression_statement; 34, return_statement; 35, identifier:sorted_attachments; 36, call; 37, identifier:float; 38, argument_list; 39, attribute; 40, argument_list; 41, attribute; 42, argument_list; 43, assignment; 44, assignment; 45, assignment; 46, assignment; 47, call; 48, identifier:sorted; 49, argument_list; 50, string:"inf"; 51, identifier:self; 52, identifier:get_attachments_order; 53, identifier:self; 54, identifier:get_attachments; 55, identifier:_n1; 56, call; 57, identifier:_n2; 58, call; 59, identifier:_i1; 60, boolean_operator; 61, identifier:_i2; 62, boolean_operator; 63, identifier:cmp; 64, argument_list; 65, identifier:attachments; 66, keyword_argument; 67, attribute; 68, argument_list; 69, attribute; 70, argument_list; 71, boolean_operator; 72, identifier:inf; 73, boolean_operator; 74, identifier:inf; 75, identifier:_i1; 76, identifier:_i2; 77, identifier:cmp; 78, identifier:att_cmp; 79, identifier:att1; 80, identifier:get; 81, string; 82, identifier:att2; 83, identifier:get; 84, string; 85, comparison_operator:_n1 in order; 86, binary_operator:order.index(_n1) + 1; 87, comparison_operator:_n2 in order; 88, binary_operator:order.index(_n2) + 1; 89, string_content:UID; 90, string_content:UID; 91, identifier:_n1; 92, identifier:order; 93, call; 94, integer:1; 95, identifier:_n2; 96, identifier:order; 97, call; 98, integer:1; 99, attribute; 100, argument_list; 101, attribute; 102, argument_list; 103, identifier:order; 104, identifier:index; 105, identifier:_n1; 106, identifier:order; 107, identifier:index; 108, identifier:_n2
code: def get_sorted_attachments(self):
          """Returns a sorted list of analysis info dictionaries
          """
          inf = float("inf")
          order = self.get_attachments_order()
          attachments = self.get_attachments()
  
          def att_cmp(att1, att2):
              _n1 = att1.get('UID')
              _n2 = att2.get('UID')
              _i1 = _n1 in order and order.index(_n1) + 1 or inf
              _i2 = _n2 in order and order.index(_n2) + 1 or inf
              return cmp(_i1, _i2)
  
          sorted_attachments = sorted(attachments, cmp=att_cmp)
          return sorted_attachments