@gen.coroutine
  def _Check(self):
    # Check for well formed input and build dict of all contacts that have been requested for removal.
    for request_contact_id in self._request_contact_ids:
      if Contact.GetContactSourceFromContactId(request_contact_id) not in Contact.UPLOAD_SOURCES:
        # remove_contacts only allows removal of Manual and iPhone sourced contacts.
        raise InvalidRequestError(BAD_CONTACT_SOURCE, Contact.GetContactSourceFromContactId(request_contact_id))

    # Get existing contacts along with list of contacts that should be deleted as part of dedup.
    existing_contacts_dict, self._contacts_to_delete = \
        yield RemoveContactsOperation._GetAllContactsWithDedup(self._client, self._user_id)

    # Projected count of removed contacts after this operation.
    removed_contact_count = 0
    # Build list of contacts to be removed.
    for existing_contact in existing_contacts_dict.itervalues():
      if existing_contact.IsRemoved():
        removed_contact_count += 1
      elif existing_contact.contact_id in self._request_contact_ids:
        # Not already in removed state, so add to list of contacts to remove during update stage.
        self._contacts_to_remove.append(existing_contact)
        removed_contact_count += 1
      # else case is no-op because there's no match of existing present contact and one being requested for removal.

    if removed_contact_count >= Contact.MAX_REMOVED_CONTACTS_LIMIT:
      # Trigger removed contact reset (garbage collection).
      self._removed_contacts_reset = True

    if self._op.checkpoint is None:
      # Set checkpoint.
      # Checkpoint whether or not we decided to reset the removed contacts.
      yield self._op.SetCheckpoint(self._client, {'removed_contacts_reset': self._removed_contacts_reset})
    elif not self._removed_contacts_reset:
      # Even if we didn't decide during this operation retry to reset the removed contacts, we still need to do it
      #   if we previously decided to because we may have already deleted some of the removed contacts and need to
      #   indicate the removed contact reset in the notification.
      self._removed_contacts_reset = self._op.checkpoint['removed_contacts_reset']

    if self._removed_contacts_reset:
      # Because we've decided to reset the contacts, we'll add more contacts to the delete list:
      #  * Any current contact that's in the 'removed' state.
      #  * Any current non-removed contact that was in the list of contacts to remove.
      for existing_contact in existing_contacts_dict.itervalues():
        if existing_contact.IsRemoved() or existing_contact.contact_id in self._request_contact_ids:
          self._contacts_to_delete.append(existing_contact)
A decorator to require that a user be logged in to access a handler.
dataset/ETHPy150Open viewfinderco/viewfinder/backend/op/remove_contacts_op.py/RemoveContactsOperation._Check--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/lib/webapp2-2.3/webapp2_extras/appengine/users.py/login_required