def is_prefix(x, pref) -> bool:
    """Check if pref is a prefix of x.
    
    Args:
        x: Label ID sequence.
        pref: Prefix label ID sequence.
        
    Returns:
        : Whether pref is a prefix of x.
    """
    if len(pref) >= len(x):
        return False

    for i in range(len(pref)):
        if pref[i] != x[i]:
            return False

    return True