def to_str(seq):
    """Decode bytestring if necessary.

    :param seq: Input bytestring, string, or other sequence.
    :return: String.
    """
    if isinstance(seq, bytes):
        value = seq.decode('utf-8')
    elif isinstance(seq, str):
        value = seq
    else:
        value = str(seq)
    return value
