'Bind the existing query to the argument list.
Assumes that the input args are first positional, then a dictionary.
So, if the query contains references to :1, :2 and :name, it is assumed
that arguments are passed as (:1, :2, dict) where dict contains a mapping
[name] -> value.
Args:
args: the arguments to bind to the object\'s unbound references.
keyword_args: dictionary-based arguments (for named parameters).
Raises:
datastore_errors.BadArgumentError: when arguments are left unbound
(missing from the inputs arguments) or when arguments do not match the
expected type.
Returns:
The bound datastore.Query object. This may take the form of a MultiQuery
object if the GQL query will require multiple backend queries to statisfy.'

def Bind(self, args, keyword_args, cursor=None, end_cursor=None):

    num_args = len(args)
    input_args = frozenset(xrange(num_args))
    used_args = set()
    queries = []
    enumerated_queries = self.EnumerateQueries(used_args, args, keyword_args)
    if enumerated_queries:
        query_count = len(enumerated_queries)
    else:
        query_count = 1
    for _ in xrange(query_count):
        queries.append(datastore.Query(self._kind, _app=self.__app, keys_only=self._keys_only, projection=self.__projection, distinct=self.__distinct, namespace=self.__namespace, cursor=cursor, end_cursor=end_cursor))
    logging.log(LOG_LEVEL, 'Binding    with    %i    positional    args    %s    and    %i    keywords    %s', len(args), args, len(keyword_args), keyword_args)
    for ((identifier, condition), value_list) in self.__filters.iteritems():
        for (operator, params) in value_list:
            value = self.__Operate(args, keyword_args, used_args, operator, params)
            if (not self.__IsMultiQuery(condition)):
                for query in queries:
                    self.__AddFilterToQuery(identifier, condition, value, query)
    unused_args = (input_args - used_args)
    if unused_args:
        unused_values = [(unused_arg + 1) for unused_arg in unused_args]
        raise datastore_errors.BadArgumentError(('Unused    positional    arguments    %s' % unused_values))
    if enumerated_queries:
        logging.log(LOG_LEVEL, 'Multiple    Queries    Bound:    %s', enumerated_queries)
        for (query, enumerated_query) in zip(queries, enumerated_queries):
            query.update(enumerated_query)
    if self.__orderings:
        for query in queries:
            query.Order(*tuple(self.__orderings))
    if (query_count > 1):
        return MultiQuery(queries, self.__orderings)
    else:
        return queries[0]
