code: def _convert_to_string(data: tp.Any, extension: str) -> str:
      """Converts the data into a string to be injected in a file"""
      if isinstance(data, np.ndarray):
          string = repr(data.tolist())
      else:
          string = repr(data)
      if extension in [".h", ".hpp", ".cpp", ".c"] and isinstance(
          data, np.ndarray
      ):  # TODO: custom extensions are handled as python
          string = string.replace("[", "{").replace("]", "}")
      return string
  
imports: import os
  import re
  import tempfile
  import operator
  import contextlib
  from pathlib import Path
  import numpy
  import nevergrad.common.typing
  from nevergrad.common import testing
  from .None import utils
label_desc: Use image node_id 1 for calling a global function with example usage: _convert_to_string(data, extension) and returns: string