Return the string representation of the given 'name'.
  If it is a bytes object, it will be converted into str.
  If it is a str object, it will simply be resurned.
171330
def str_(name):
  """"""
  if isinstance(name, bytes) and not isinstance(name, str):
    return name.decode('utf8')
  else:
    return name
1259522
def to_str(s):
    
    if isinstance(s, bytes):
        s = s.decode('utf-8')
    elif not isinstance(s, str):
        s = str(s)
    return s
262602
def write_name(self, name):
        """"""

        try:
            # Find existing instance of this name in packet
            #
            index = self.names[name]
        except KeyError:
            # No record of this name already, so write it
            # out as normal, recording the location of the name
            # for future pointers to it.
            #
            self.names[name] = self.size
            parts = name.split('.')
            if parts[-1] == '':
                parts = parts[:-1]
            for part in parts:
                self.write_utf(part)
            self.write_byte(0)
            return

        # An index was found, so write a pointer to it
        #
        self.write_byte((index >> 8) | 0xC0)
        self.write_byte(index)
1214458
public String getString(T name) {
         return (attributes.containsKey(name)) ? attributes.get(name)[0] : null;
    }
556429
def string(self, *args):
        
        data = self.bytes(*args)
        if data is not None:
            return data.rstrip(b"\x00").decode('utf-8')
812260
public String getString(ByteBuffer bytes)
    {
        TypeSerializer<T> serializer = getSerializer();
        serializer.validate(bytes);

        return serializer.toString(serializer.deserialize(bytes));
    }
434578
def to_string(s, encoding=None, errors='strict'):
    """"""
    encoding = encoding or 'utf-8'
    if isinstance(s, bytes):
        return s.decode(encoding, errors)
    if not is_string(s):
        s = string_type(s)
    return s
56563
def ub_to_str(string):
    
    if not isinstance(string, str):
        if six.PY2:
            return str(string)
        else:
            return string.decode()
    return string
51906
def getName(self, length=512):
        
        name = ctypes.create_string_buffer(length)
        self._ioctl(_HIDIOCGRAWNAME(length), name, True)
        return name.value.decode('UTF-8')
314589
def String(self, str):
        
        ret = libxml2mod.xmlTextReaderConstString(self._o, str)
        return ret
595458
def to_str(self):
        ''''''
        pairs = []
        for name, value in self.get_all():
            if value and self._wrap_width:
                pairs.append('{0}:{1}'.format(
                    name,
                    '\r\n'.join(textwrap.wrap(
                        value, width=self._wrap_width,
                        drop_whitespace=False, initial_indent=' ',
                        subsequent_indent=' '
                    ))
                ))
            elif value:
                pairs.append('{0}: {1}'.format(name, value))
            else:
                pairs.append('{0}:'.format(name))

        pairs.append('')
        return '\r\n'.join(pairs)
1088351
def to_str(s, encoding=None, errors='strict'):
    
    encoding = encoding or 'utf-8'

    if is_strlike(s):
        if six.PY2:
            return s.encode(encoding, errors) if isinstance(s, unicode) else s
        else:
            return s.decode(encoding, errors) if isinstance(s, bytes) else s
    else:
        return str(s)
1113636
def to_bytes(s):  # pragma: nocover
    
    if isinstance(s, bytes):
        return s
    if isinstance(s, str) or is_unicode(s):
        return s.encode("utf-8")
    try:
        return unicode(s).encode("utf-8")
    except NameError:
        return str(s).encode("utf-8")
559352
def _get_input_format_from_name(self, name):
        
        try:
            int(name)
            src_format = 'ISOnumeric'
        except ValueError:
            if len(name) == 2:
                src_format = 'ISO2'
            elif len(name) == 3:
                src_format = 'ISO3'
            else:
                src_format = 'regex'
        return src_format
1216480
def to_str(self, s):
        '''
        
        '''
        if s.__class__ != str:
            if not IS_PY3K:
                s = s.encode('utf-8')
            else:
                raise AssertionError('Expected to have str on Python 3. Found: %s (%s)' % (s, s.__class__))
        return s
509523
def _name_attribute_to_string(self, name):
        
        return "".join(
            "/{}={}".format(
                self._get_oid_name(attr.oid),
                attr.value,
            )
            for attr in name
        )
567046
def _raw_name_string(bufr, strings_offset, str_offset, length):
        
        offset = strings_offset + str_offset
        tmpl = '%ds' % length
        return unpack_from(tmpl, bufr, offset)[0]