@classmethod
def dump(cls, data, encoding='ascii'):
    '\n        Convert str to appropriate format for "UserComment".\n\n        :param data: Like u"foobar"\n        :param str encoding: "ascii", "jis", or "unicode"\n        :return: b"ASCII\x00\x00\x00foobar"\n        :rtype: bytes\n        :raises: ValueError if the encoding is unsupported.\n        '
    if encoding not in cls.ENCODINGS:
        raise ValueError('encoding {!r} must be one of {!r}'.format(
            encoding, cls.ENCODINGS))
    prefix = {cls.ASCII: cls._ASCII_PREFIX, cls.JIS: cls._JIS_PREFIX, cls.
        UNICODE: cls._UNICODE_PREFIX}[encoding]
    internal_encoding = {cls.UNICODE: cls._UNICODE, cls.JIS: cls._JIS}.get(
        encoding, encoding)
    return prefix + data.encode(internal_encoding, errors='replace')
