code: def sec_to_hms(seconds, ms_places=5, as_str=False):
      """Convert `seconds` to hours, minutes, and seconds
  
      Parameters
      ----------
      seconds: Integer
          Number of total seconds to be converted to hours, minutes, seconds format
      ms_places: Integer, default=5
          Rounding precision for calculating number of seconds
      as_str: Boolean, default=False
          If True, return string "{hours} h, {minutes} m, {seconds} s". Else, return a triple
  
      Returns
      -------
      String or tuple
          If `as_str=True`, return a formatted string containing the hours, minutes, and seconds.
          Else, return a 3-item tuple of (hours, minutes, seconds)
  
      Examples
      --------
      >>> assert sec_to_hms(55, as_str=True) == '55 s'
      >>> assert sec_to_hms(86400) == (24, 0, 0)
      >>> assert sec_to_hms(86400, as_str=True) == '24 h'
      >>> assert sec_to_hms(86370) == (23, 59, 30)
      >>> assert sec_to_hms(86370, as_str=True) == '23 h, 59 m, 30 s'
      """
      t_hour, temp_sec = divmod(seconds, 3600)
      t_min, t_sec = divmod(temp_sec, 60)
      t_sec = round(t_sec, ms_places)
  
      if as_str is True:
          result = ""
          if t_hour != 0:
              result += "{} h, ".format(t_hour)
          if t_min != 0:
              result += "{} m, ".format(t_min)
          if t_sec != 0:
              result += "{} s".format(t_sec)
          return result.strip(", ")
      else:
          return (t_hour, t_min, t_sec)
  
imports: from hyperparameter_hunter.utils.boltons_utils import remap, default_enter
  from datetime import datetime
  from inspect import Traceback
  import re
  import string
  from typing import Any, Callable, Iterable, List, Tuple, Union
  import wrapt
label_desc: Use image node_id 6 for calling a global function with example usage: sec_to_hms(seconds, ms_places, as_str) and returns: result, t_hour,  t_min,  t_sec