code: def mofval(value, indent=MOF_INDENT, maxline=MAX_MOF_LINE, line_pos=0,
             end_space=0):
      
  
      assert isinstance(value, six.text_type)
  
      # Check for output on current line
      avl_len = maxline - line_pos - end_space
      if len(value) <= avl_len:
          line_pos += len(value)
          return value, line_pos
  
      # Check for output on new line
      avl_len = maxline - indent - end_space
      if len(value) <= avl_len:
          mof_str = u'\n' + _indent_str(indent) + value
          line_pos = indent + len(value)
          return mof_str, line_pos
  
      raise ValueError(
          _format("Cannot fit value {0!A} onto new MOF line, missing {1} "
                  "characters", value, len(value) - avl_len))
docs: Low level function that returns the MOF representation of a non-string
      value (i.e. a value that cannot not be split into multiple parts, for
      example a numeric or boolean value).
  
      If the MOF representation of the value does not fit into the remaining
      space of the current line, it is put into a new line, considering the
      specified indentation. If it also does not fit on the remaining space of
      the new line, ValueError is raised.
  
      Parameters:
  
        value (:term:`unicode string`): The non-string value. Must not be `None`.
  
        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.
  
      Returns:
  
        tuple of
          * :term:`unicode string`: MOF string.
          * new line_pos
  
      Raises:
  
        ValueError: The value does not fit onto an entire new line.