nodes: 0, module; 1, function_definition; 2, function_name:frames; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, for_statement; 12, if_statement; 13, expression_statement; 14, return_statement; 15, identifier:key; 16, None; 17, identifier:orig_order; 18, False; 19, comment:"""Returns a list of frames in this tag.
          If KEY is None, returns all frames in the tag; otherwise returns all frames
          whose frameid matches KEY.
          
          If ORIG_ORDER is True, then the frames are returned in their original order.
          Otherwise the frames are sorted in canonical order according to the frame_order
          field of this tag.
          """; 20, comparison_operator:key is not None; 21, comment:# If there are multiple frames, then they are already in original order.; 22, block; 23, assignment; 24, identifier:frameid; 25, call; 26, block; 27, identifier:orig_order; 28, block; 29, else_clause; 30, call; 31, identifier:frames; 32, identifier:key; 33, None; 34, expression_statement; 35, if_statement; 36, return_statement; 37, identifier:frames; 38, list; 39, attribute; 40, argument_list; 41, for_statement; 42, expression_statement; 43, block; 44, attribute; 45, argument_list; 46, assignment; 47, comparison_operator:len(self._frames[key]) == 0; 48, block; 49, subscript; 50, attribute; 51, identifier:keys; 52, identifier:frame; 53, subscript; 54, block; 55, assignment; 56, expression_statement; 57, identifier:frames; 58, identifier:sort; 59, keyword_argument; 60, identifier:key; 61, call; 62, call; 63, integer:0; 64, raise_statement; 65, attribute; 66, identifier:key; 67, identifier:self; 68, identifier:_frames; 69, attribute; 70, identifier:frameid; 71, expression_statement; 72, identifier:key; 73, parenthesized_expression; 74, assignment; 75, identifier:key; 76, identifier:key; 77, attribute; 78, argument_list; 79, identifier:len; 80, argument_list; 81, call; 82, identifier:self; 83, identifier:_frames; 84, identifier:self; 85, identifier:_frames; 86, call; 87, lambda; 88, identifier:key; 89, attribute; 90, identifier:self; 91, identifier:_normalize_key; 92, identifier:key; 93, subscript; 94, identifier:KeyError; 95, argument_list; 96, attribute; 97, argument_list; 98, lambda_parameters; 99, conditional_expression:(0, frame.frameno) 
                     if frame.frameno is not None 
                     else (1,); 100, attribute; 101, identifier:key; 102, attribute; 103, identifier:key; 104, binary_operator:"Key not found: " + repr(key); 105, identifier:frames; 106, identifier:append; 107, identifier:frame; 108, identifier:frame; 109, tuple; 110, comparison_operator:frame.frameno is not None; 111, tuple; 112, identifier:self; 113, identifier:frame_order; 114, identifier:self; 115, identifier:_frames; 116, string:"Key not found: "; 117, call; 118, integer:0; 119, attribute; 120, attribute; 121, None; 122, integer:1; 123, identifier:repr; 124, argument_list; 125, identifier:frame; 126, identifier:frameno; 127, identifier:frame; 128, identifier:frameno; 129, identifier:key
code: def frames(self, key=None, orig_order=False):
          """Returns a list of frames in this tag.
          If KEY is None, returns all frames in the tag; otherwise returns all frames
          whose frameid matches KEY.
          
          If ORIG_ORDER is True, then the frames are returned in their original order.
          Otherwise the frames are sorted in canonical order according to the frame_order
          field of this tag.
          """
          if key is not None:
              # If there are multiple frames, then they are already in original order.
              key = self._normalize_key(key)
              if len(self._frames[key]) == 0:
                  raise KeyError("Key not found: " + repr(key))
              return self._frames[key]
          
          frames = []
          for frameid in self._frames.keys():
              for frame in self._frames[frameid]:
                  frames.append(frame)
          if orig_order:
              key = (lambda frame: 
                     (0, frame.frameno) 
                     if frame.frameno is not None 
                     else (1,))
          else:
              key = self.frame_order.key
          frames.sort(key=key)
          return frames