code: def _value_tomof(
          value, type, indent=0, maxline=MAX_MOF_LINE, line_pos=0, end_space=0,
          avoid_splits=False):
      # pylint: disable=redefined-builtin
      
  
      if isinstance(value, list):
  
          mof = []
  
          for i, v in enumerate(value):
  
              if i > 0:
                  # Assume we would add comma and space as separator
                  line_pos += 2
  
              val_str, line_pos = _scalar_value_tomof(
                  v, type, indent, maxline, line_pos, end_space + 2, avoid_splits)
  
              if i > 0:
                  # Add the actual separator
                  mof.append(u',')
                  if val_str[0] != '\n':
                      mof.append(u' ')
                  else:
                      # Adjust by the space we did not need
                      line_pos -= 1
  
              mof.append(val_str)
  
          mof_str = u''.join(mof)
  
      else:
          mof_str, line_pos = _scalar_value_tomof(
              value, type, indent, maxline, line_pos, end_space, avoid_splits)
  
      return mof_str, line_pos
docs: Return a MOF string representing a CIM-typed value (scalar or array).
  
      In case of an array, the array items are separated by comma, but the
      surrounding curly braces are not added.
  
      Parameters:
  
        value (CIM-typed value or list of CIM-typed values): The value.
  
        indent (:term:`integer`): Number of spaces to indent any new lines that
          are generated.
  
        maxline (:term:`integer`): Maximum line length for the generated MOF.
  
        line_pos (:term:`integer`): Length of content already on the current
          line.
  
        end_space (:term:`integer`): Length of space to be left free on the last
          line.
  
        avoid_splits (bool): Avoid splits at the price of starting a new line
          instead of using the current line.
  
      Returns:
  
        tuple of
          * :term:`unicode string`: MOF string.
          * new line_pos