def is_valid_start(prefix_label, encoding="BIO"):
    """Returns whether the prefix label is allowed to start a sequence"""

    return (prefix_label == "O"
            or prefix_label.startswith("B-")
            or prefix_label.startswith("U-") or
            (prefix_label.startswith("I-") and "B" not in encoding))