nodes: 0, module; 1, function_definition; 2, function_name:flds_firstsort; 3, parameters; 4, block; 5, identifier:d; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, string; 11, assignment; 12, assignment; 13, expression_list; 14, string_content:Perform a lexsort and return the sort indices and shape as a tuple.; 15, identifier:shape; 16, list_comprehension; 17, identifier:si; 18, call; 19, identifier:si; 20, identifier:shape; 21, call; 22, for_in_clause; 23, attribute; 24, argument_list; 25, identifier:len; 26, argument_list; 27, identifier:l; 28, list; 29, identifier:np; 30, identifier:lexsort; 31, tuple; 32, call; 33, string; 34, string; 35, string; 36, subscript; 37, subscript; 38, subscript; 39, attribute; 40, argument_list; 41, string_content:xs; 42, string_content:ys; 43, string_content:zs; 44, identifier:d; 45, string; 46, identifier:d; 47, string; 48, identifier:d; 49, string; 50, identifier:np; 51, identifier:unique; 52, subscript; 53, string_content:z; 54, string_content:y; 55, string_content:x; 56, identifier:d; 57, identifier:l
code: def flds_firstsort(d):
      '''
      Perform a lexsort and return the sort indices and shape as a tuple.
      '''
      shape = [ len( np.unique(d[l]) )
                for l in ['xs', 'ys', 'zs'] ];
      si = np.lexsort((d['z'],d['y'],d['x']));
      return si,shape;