def METHOD_NAME(cls, inst, soft7=True, with_uuid=False):
    """Save instance `inst` to bytes (or bytearray) object.  Optional.
    Arguments:
        inst: Instance to save.
        soft7: Whether to structure metadata as SOFT7.
        with_uuid: Whether to include UUID in the output.
    Returns:
        The bytes (or bytearray) object that the instance is saved to.
    """
    return pyyaml.safe_dump(
        inst.asdict(soft7=soft7, uuid=with_uuid),
        default_flow_style=False,
        sort_keys=False,
    ).encode()