def _as_symbol(value, is_symbol_value=True):
    """Converts the input to a :class:`SymbolToken` suitable for being emitted as part of a :class:`IonEvent`.

    If the input has an `as_symbol` method (e.g. :class:`CodePointArray`), it will be converted using that method.
    Otherwise, it must already be a `SymbolToken`. In this case, there is nothing to do unless the input token is not a
    symbol value and it is an :class:`_IVMToken`. This requires the `_IVMToken` to be converted to a regular
    `SymbolToken`.
    """
    try:
        return value.as_symbol()
    except AttributeError:
        assert isinstance(value, SymbolToken)
    if not is_symbol_value:
        try:
            # This converts _IVMTokens to regular SymbolTokens when the _IVMToken cannot represent an IVM (i.e.
            # it is a field name or annotation).
            return value.regular_token()
        except AttributeError:
            pass
    return value
Converts the input to a :class:`SymbolToken` suitable for being emitted as part of a :class:`IonEvent`.

    If the input has an `as_symbol` method (e.g. :class:`CodePointArray`), it will be converted using that method.
    Otherwise, it must already be a `SymbolToken`. In this case, there is nothing to do unless the input token is not a
    symbol value and it is an :class:`_IVMToken`. This requires the `_IVMToken` to be converted to a regular
    `SymbolToken`.