<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def build( self, *, remote: str = None, fileobj: BinaryIO = None, path_dockerfile: str = None, tag: str = None, quiet: bool = False, nocache: bool = False, buildargs: Mapping = None, pull: bool = False, rm: bool = True, forcerm: bool = False, labels: Mapping = None, stream: bool = False, encoding: str = None ) -> Mapping: """ Build an image given a remote Dockerfile or a file object with a Dockerfile inside Args: path_dockerfile: path within the build context to the Dockerfile remote: a Git repository URI or HTTP/HTTPS context URI quiet: suppress verbose build output nocache: do not use the cache when building the image rm: remove intermediate containers after a successful build pull: downloads any updates to the FROM image in Dockerfiles encoding: set `Content-Encoding` for the file object your send forcerm: always remove intermediate containers, even upon failure labels: arbitrary key/value labels to set on the image fileobj: a tar archive compressed or not """


        local_context = None

        headers = {}

        params = {
            "t": tag,
            "rm": rm,
            "q": quiet,
            "pull": pull,
            "remote": remote,
            "nocache": nocache,
            "forcerm": forcerm,
            "dockerfile": path_dockerfile,
        }

        if remote is None and fileobj is None:
            raise ValueError("You need to specify either remote or fileobj")

        if fileobj and remote:
            raise ValueError("You cannot specify both fileobj and remote")

        if fileobj and not encoding:
            raise ValueError("You need to specify an encoding")

        if remote is None and fileobj is None:
            raise ValueError("Either remote or fileobj needs to be provided.")

        if fileobj:
            local_context = fileobj.read()
            headers["content-type"] = "application/x-tar"

        if fileobj and encoding:
            headers["Content-Encoding"] = encoding

        if buildargs:
            params.update({"buildargs": json.dumps(buildargs)})

        if labels:
            params.update({"labels": json.dumps(labels)})

        response = await self.docker._query(
            "build",
            "POST",
            params=clean_map(params),
            headers=headers,
            data=local_context,
        )

        return await json_stream_result(response, stream=stream)