code: def prepare(self, statement):
          
          self._check_closed()
          self._column_types = None
          statement_id = params_metadata = result_metadata_part = None
  
          request = RequestMessage.new(
              self.connection,
              RequestSegment(
                  message_types.PREPARE,
                  Command(statement)
              )
          )
          response = self.connection.send_request(request)
  
          for part in response.segments[0].parts:
              if part.kind == part_kinds.STATEMENTID:
                  statement_id = part.statement_id
              elif part.kind == part_kinds.PARAMETERMETADATA:
                  params_metadata = part.values
              elif part.kind == part_kinds.RESULTSETMETADATA:
                  result_metadata_part = part
  
          # Check that both variables have been set in previous loop, we need them:
          assert statement_id is not None
          assert params_metadata is not None
          # cache statement:
          self._prepared_statements[statement_id] = PreparedStatement(self.connection, statement_id,
                                                                      params_metadata, result_metadata_part)
          return statement_id
docs: Prepare SQL statement in HANA and cache it
          :param statement; a valid SQL statement
          :returns: statement_id (of prepared and cached statement)