def _match_single_glob_tokens(path_tokens, prefix_tokens):
    """If the prefix matches the path (anchored at the start), returns the
    segment of the path tokens that matched -- or None if no match.  The
    arguments are lists of strings, with an implied "/" between elements.

    The token "*" must match exactly one path token.
    The token "**" is not allowed.
    """
    if len(prefix_tokens) > len(path_tokens):
        # The prefix is too long ==> no match.
        return None

    # Check the tokens pairwise (stopping at the shorter of the two lists).
    for prefix, path in zip(prefix_tokens, path_tokens):
        if prefix == "*":
            # The "*" matches anything.
            continue
        if prefix != path:
            # Mismatch.
            return None

    # Successful match.
    return path_tokens[:len(prefix_tokens)]