def un_pad_and_decode(padded: bytes) -> str:
    """
    Un-pads the given data sequence by stripping trailing null characters and
        recodes it at utf-8.
    """
    return padded.rstrip(b"\0").decode("utf-8")