nodes: 0, module; 1, function_definition; 2, function_name:validate_inputs; 3, parameters; 4, block; 5, list_splat_pattern; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, if_statement; 12, if_statement; 13, return_statement; 14, identifier:arrays; 15, identifier:kwargs; 16, comment:"""Validate input arrays
  
      This checks that
      - Arrays are mutually broadcastable
      - Broadcasted arrays are one-dimensional
  
      Optionally, arrays are sorted according to the ``sort_by`` argument.
  
      Parameters
      ----------
      *args : ndarrays
          All non-keyword arguments are arrays which will be validated
      sort_by : array
          If specified, sort all inputs by the order given in this array.
      """; 17, assignment; 18, assignment; 19, identifier:kwargs; 20, block; 21, comparison_operator:arrays[0].ndim != 1; 22, block; 23, comparison_operator:sort_by is not None; 24, block; 25, identifier:arrays; 26, identifier:arrays; 27, call; 28, identifier:sort_by; 29, call; 30, raise_statement; 31, attribute; 32, integer:1; 33, raise_statement; 34, identifier:sort_by; 35, None; 36, expression_statement; 37, if_statement; 38, expression_statement; 39, attribute; 40, argument_list; 41, attribute; 42, argument_list; 43, call; 44, subscript; 45, identifier:ndim; 46, call; 47, assignment; 48, comparison_operator:isort.shape != arrays[0].shape; 49, block; 50, assignment; 51, identifier:np; 52, identifier:broadcast_arrays; 53, list_splat; 54, identifier:kwargs; 55, identifier:pop; 56, string; 57, None; 58, identifier:ValueError; 59, argument_list; 60, identifier:arrays; 61, integer:0; 62, identifier:ValueError; 63, argument_list; 64, identifier:isort; 65, call; 66, attribute; 67, attribute; 68, raise_statement; 69, identifier:arrays; 70, call; 71, identifier:arrays; 72, string_content:sort_by; 73, call; 74, string:"Input arrays should be one-dimensional."; 75, attribute; 76, argument_list; 77, identifier:isort; 78, identifier:shape; 79, subscript; 80, identifier:shape; 81, call; 82, identifier:tuple; 83, argument_list; 84, attribute; 85, argument_list; 86, identifier:np; 87, identifier:argsort; 88, identifier:sort_by; 89, identifier:arrays; 90, integer:0; 91, identifier:ValueError; 92, argument_list; 93, list_comprehension; 94, string:"unrecognized arguments: {0}"; 95, identifier:format; 96, call; 97, string:"sort shape must equal array shape."; 98, subscript; 99, for_in_clause; 100, attribute; 101, argument_list; 102, identifier:a; 103, identifier:isort; 104, identifier:a; 105, identifier:arrays; 106, identifier:kwargs; 107, identifier:keys
code: def validate_inputs(*arrays, **kwargs):
      """Validate input arrays
  
      This checks that
      - Arrays are mutually broadcastable
      - Broadcasted arrays are one-dimensional
  
      Optionally, arrays are sorted according to the ``sort_by`` argument.
  
      Parameters
      ----------
      *args : ndarrays
          All non-keyword arguments are arrays which will be validated
      sort_by : array
          If specified, sort all inputs by the order given in this array.
      """
      arrays = np.broadcast_arrays(*arrays)
      sort_by = kwargs.pop('sort_by', None)
  
      if kwargs:
          raise ValueError("unrecognized arguments: {0}".format(kwargs.keys()))
  
      if arrays[0].ndim != 1:
          raise ValueError("Input arrays should be one-dimensional.")
  
      if sort_by is not None:
          isort = np.argsort(sort_by)
          if isort.shape != arrays[0].shape:
              raise ValueError("sort shape must equal array shape.")
          arrays = tuple([a[isort] for a in arrays])
      return arrays