code: async def send_trailing_metadata(self, *, status=Status.OK,
                                       status_message=None, metadata=None):
          
          if self._send_trailing_metadata_done:
              raise ProtocolError('Trailing metadata was already sent')
  
          if (
              not self._cardinality.server_streaming
              and not self._send_message_count
              and status is Status.OK
          ):
              raise ProtocolError('Unary response with OK status requires '
                                  'a single message to be sent')
  
          if self._send_initial_metadata_done:
              headers = []
          else:
              # trailers-only response
              headers = [(':status', '200')]
  
          headers.append(('grpc-status', str(status.value)))
          if status_message is not None:
              headers.append(('grpc-message',
                              encode_grpc_message(status_message)))
  
          metadata = MultiDict(metadata or ())
          metadata, = await self._dispatch.send_trailing_metadata(metadata)
          headers.extend(encode_metadata(metadata))
  
          await self._stream.send_headers(headers, end_stream=True)
          self._send_trailing_metadata_done = True
  
          if status != Status.OK and self._stream.closable:
              self._stream.reset_nowait()
docs: Coroutine to send trailers with trailing metadata to the client.
  
          This coroutine allows sending trailers-only responses, in case of some
          failure conditions during handling current request, i.e. when
          ``status is not OK``.
  
          .. note:: This coroutine will be called implicitly at exit from
              request handler, with appropriate status code, if not called
              explicitly during handler execution.
  
          :param status: resulting status of this coroutine call
          :param status_message: description for a status
          :param metadata: custom trailing metadata, dict or list of pairs