code: def _infer_num_if_needed_for_1d_array(
      num: Union[int, str], array: Iterable[int]
  ) -> int:
      """Return ``num`` or, if ``None``, the maximum value of ``array`` + 1."""
      if num == "infer":
          num = max(array) + 1
  
      return num
  
imports: from datetime import datetime
  import inspect
  from pathlib import Path
  import re
  import time
  from typing import Any, Dict, Iterable, List, Optional, Union
  import docstring_parser
  import numpy
  import pandas
  import pytorch_lightning
  from scipy.sparse import coo_matrix
  import torch
  from collie.interactions import Interactions
label_desc: Use image node_id 4 for calling a global function with example usage: _infer_num_if_needed_for_1d_array(num, array) and returns: num