def _process_principal(self, principal_cls, principals, legacy_principal, name, read_access=None, full_access=None,
                           roles=None, allow_emails=True):
        if legacy_principal is None:
            return
        elif isinstance(legacy_principal, basestring):
            user = self.importer.all_users_by_email.get(legacy_principal)
            principal = user or EmailPrincipal(legacy_principal)
        else:
            principal = self._convert_principal(legacy_principal)
        if principal is None:
            self.importer.print_warning(cformat('%{yellow}{} does not exist:%{reset} {}')
                                        .format(name, legacy_principal), always=False, event_id=self.event.id)
            return
        elif not allow_emails and isinstance(principal, EmailPrincipal):
            self.importer.print_warning(cformat('%{yellow}{} cannot be an email principal:%{reset} {}')
                                        .format(name, legacy_principal), always=False, event_id=self.event.id)
            return
        try:
            entry = principals[principal]
        except KeyError:
            entry = principal_cls(principal=principal, full_access=False, roles=[])
            principals[principal] = entry
        if read_access:
            entry.read_access = True
        if full_access:
            entry.full_access = True
        if roles:
            entry.roles = sorted(set(entry.roles) | set(roles))
        if not self.importer.quiet:
            self.importer.print_info(' - [{}] {}'.format(name.lower(), principal))