def RemoveNativelySupportedComponents(filters, orders):
  (filters, orders) = Normalize(filters, orders)

  has_key_desc_order = False
  if orders and orders[-1].property() == datastore_types._KEY_SPECIAL_PROPERTY:
    if orders[-1].direction() == ASCENDING:
      orders = orders[:-1]
    else:
      has_key_desc_order = True

  if not has_key_desc_order:
    for f in filters:
      if (f.op() in INEQUALITY_OPERATORS and
          f.property(0).name() != datastore_types._KEY_SPECIAL_PROPERTY):
        break
    else:
      filters = [f for f in filters
          if f.property(0).name() != datastore_types._KEY_SPECIAL_PROPERTY]

  return (filters, orders)
Regression test for #10153: foreign key __gte lookups.
dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/datastore/datastore_index.py/RemoveNativelySupportedComponents--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/regressiontests/model_regress/tests.py/ModelTests.test_related_gte_lookup