def _AddBindVariablesToRequest(self, statement, args, bind_variable_factory,
                                 direction=client_pb2.BindVariableProto.IN):
    """Add args to the request BindVariableProto list.

    Args:
      statement: The SQL statement.
      args: Sequence of arguments to turn into BindVariableProtos.
      bind_variable_factory: A callable which returns new BindVariableProtos.
      direction: The direction to set for all variables in the request.

    Raises:
      InterfaceError: Unknown type used as a bind variable.
    """
    if isinstance(args, dict):
      args = _ConvertArgsDictToList(statement, args)

    for i, arg in enumerate(args):
      bv = bind_variable_factory()
      bv.position = i + 1
      bv.direction = direction
      if arg is None:
        bv.type = jdbc_type.NULL
      else:
        try:
          bv.type, bv.value = self._EncodeVariable(arg)
        except __HOLE__:
          raise InterfaceError('unknown type %s for arg %d' % (type(arg), i))
dataset/ETHPy150Open AppScale/appscale/AppServer/google/storage/speckle/python/api/rdbms.py/Cursor._AddBindVariablesToRequest