def handle(self, *args, **options):
        """Main entry point for the command"""

        # retrieve configuration options--give precedence to CLI parameters
        self.config = getattr(settings, 'ARTICLES_FROM_EMAIL', {})
        s = lambda k, d: self.config.get(k, d)

        protocol = options['protocol'] or s('protocol', MB_IMAP4)
        host = options['host'] or s('host', 'mail.yourhost.com')
        port = options['port'] or s('port', None)
        keyfile = options['keyfile'] and s('keyfile', None)
        certfile = options['certfile'] or s('certfile', None)
        username = options['username'] or s('user', None)
        password = options['password'] or s('password', None)
        ssl = options['ssl'] or s('ssl', False)

        self.verbosity = int(options.get('verbosity', 1))

        handle = None
        try:
            self.log('Creating mailbox handle')
            handle = MailboxHandler.get_handle(protocol, host, port, username, password, keyfile, certfile, ssl)

            self.log('Fetching messages')
            messages = handle.fetch()

            if len(messages):
                self.log('Creating articles')
                created = self.create_articles(messages)

                if len(created):
                    self.log('Deleting consumed messages')
                    handle.delete_messages(created)
                else:
                    self.log('No articles created')
            else:
                self.log('No messages fetched')
        except socket.error:
            self.log('Failed to communicate with mail server.  Please verify your settings.', 0)
        finally:
            if handle:
                try:
                    handle.disconnect()
                    self.log('Disconnected.')
                except socket.error:
                    # probably means we couldn't connect to begin with
                    pass
dataset/ETHPy150Open codekoala/django-articles/articles/management/commands/check_for_articles_from_email.py/Command.handle/operator `or` -> `and`