mutagen/apev2.py
def APEValue(value, kind):
    """APEv2 tag value factory.

    Use this if you need to specify the value's type manually.  Binary
    and text data are automatically detected by APEv2.__setitem__.
    """

    if kind in (TEXT, EXTERNAL):
        if not isinstance(value, text_type):
            # stricter with py3
            if PY3:
                raise TypeError("str only for text/external values")
        else:
            value = value.encode("utf-8")

    if kind == TEXT:
        return APETextValue(value, kind)
    elif kind == BINARY:
        return APEBinaryValue(value, kind)
    elif kind == EXTERNAL:
        return APEExtValue(value, kind)
    else:
        raise ValueError("kind must be TEXT, BINARY, or EXTERNAL")
def APEValue(value, kind):
    if kind in (TEXT, EXTERNAL):
        if not isinstance(value, text_type):
            # stricter with py3
            if PY3:
                raise TypeError("str only for text/external values")
        else:
            value = value.encode("utf-8")

    if kind == TEXT:
        return APETextValue(value, kind)
    elif kind == BINARY:
        return APEBinaryValue(value, kind)
    elif kind == EXTERNAL:
        return APEExtValue(value, kind)
    else:
        raise ValueError("kind must be TEXT, BINARY, or EXTERNAL")
def APEValue ( value , kind ) : if kind in ( TEXT , EXTERNAL ) : if not isinstance ( value , text_type ) : # stricter with py3 if PY3 : raise TypeError ( "str only for text/external values" ) else : value = value . encode ( "utf-8" ) if kind == TEXT : return APETextValue ( value , kind ) elif kind == BINARY : return APEBinaryValue ( value , kind ) elif kind == EXTERNAL : return APEExtValue ( value , kind ) else : raise ValueError ( "kind must be TEXT, BINARY, or EXTERNAL" )
APEv2 tag value factory.

    Use this if you need to specify the value's type manually.  Binary
    and text data are automatically detected by APEv2.__setitem__.
APEv2 tag value factory .