Produce a formatted record of a times data structure.

    Args:
        times (Times, optional): If not provided, uses the current root timer.

    Returns:
        str: Timer tree hierarchy in a formatted string.

    Raises:
        TypeError: If provided argument is not a Times object.

def write_structure(times=None):
    """
    Produce a formatted record of a times data structure.

    Args:
        times (Times, optional): If not provided, uses the current root timer.

    Returns:
        str: Timer tree hierarchy in a formatted string.

    Raises:
        TypeError: If provided argument is not a Times object.
    """
    if times is None:
        return report_loc.write_structure(f.root.times)
    else:
        if not isinstance(times, Times):
            raise TypeError("Expected Times instance for param 'times' (default is root).")
        return report_loc.write_structure(times)