import re


def _path_requires_gfile(filepath):
    """Checks if the given path requires use of GFile API.

    Args:
        filepath (str): Path to check.
    Returns:
        bool: True if the given path needs GFile API to access, such as
            "s3://some/path" and "gs://some/path".
    """
    # If the filepath contains a protocol (e.g. "gs://"), it should be handled
    # using TensorFlow GFile API.
    return bool(re.match(r"^[a-z]+://", filepath))