"You should provide either a client or a location but not both "
                "of them."
            )
        if not client and not location:
            raise ValueError(
                "You must specify either a client or a location to instantiate "
                "a client."
            )
        self._gcs_output_path = gcs_output_path
        self._processor_name = processor_name
        if client:
            self._client = client
        else:
            try:
                from google.api_core.client_options import ClientOptions
                from google.cloud.documentai import DocumentProcessorServiceClient
            except ImportError:
                raise ImportError(
                    "documentai package not found, please install it with"
                    " `pip install google-cloud-documentai`"
                )
            options = ClientOptions(
                api_endpoint=f"{location}-documentai.googleapis.com"
            )
            self._client = DocumentProcessorServiceClient(client_options=options)
[docs]    def lazy_parse(self, blob: Blob) -> Iterator[Document]:
        """Parses a blob lazily.
        Args:
            blobs: a Blob to parse
        This is a long-running operations! A recommended way is to batch
            documents together and use `batch_parse` method.
        """
        yield from self.batch_parse([blob], gcs_output_path=self._gcs_output_path)
[docs]    def batch_parse(
        self,
        blobs: Sequence[Blob],
        gcs_output_path: Optional[str] = None,
        timeout_sec: int = 3600,
        check_in_interval_sec: int = 60,
    ) -> Iterator[Document]:
        """Parses a list of blobs lazily.
        Args:
            blobs: a list of blobs to parse