${cmd_name}: pull the remote maildir into the local maildir.

        ${cmd_usage}
        ${cmd_option_list}

        The REMOTE_MAILDIR is a url which specifies where the dir
        is. A few different forms are supported:

          ssh://user@hostname/path   is a remote directory at path, accessed via ssh
          file://path                is a local maildir directory at path

def do_pull(self, subcmd, opts, remote_maildir):
        """${cmd_name}: pull the remote maildir into the local maildir.

        ${cmd_usage}
        ${cmd_option_list}

        The REMOTE_MAILDIR is a url which specifies where the dir
        is. A few different forms are supported:

          ssh://user@hostname/path   is a remote directory at path, accessed via ssh
          file://path                is a local maildir directory at path
        """
        import mdlib.pull 
        m = re.match(
            "(?P<protocol>[a-z]+)://(?P<urlpart>.*)",
            remote_maildir
            )
        if not m:
            print("md pull: the remote maildir url was unrecognized", file=self.stderr)
            return

        local_maildir = self.maildir
        noop = getattr(opts, "noop", False) or False
        verbose = getattr(self.options, "verbose", False) or False
        filterfile = getattr(opts, "filter", None) or None

        try:
            filterfd = open(filterfile)
        except:
            filterfd = None
            # Some error loading the filterfile
            if verbose:
                print("md pull: could not load filter file", file=self.stderr)

        data = m.groupdict()
        if data.get("protocol") == "ssh":
            m = re.match(
                "(?P<user>[a-zA-Z0-9-]+@)*(?P<hostname>[a-zA-Z0-9.-]+)(?P<path>[a-zA-Z0-9./-]+)",
                data.get("urlpart")
                )
            if not m:
                print("md pull: %s was not a remote maildir" % remote_maildir, file=self.stderr)
                return
            data = m.groupdict()
            host = data.get("hostname", None) \
                if not data.get("user", None) \
                else "%s@%s" % (data.get("user"), data.get("hostname"))
            remote_maildir = data.get("path")
            mdlib.pull.sshpull(host, remote_maildir, local_maildir, noop, verbose, filterfd)
        elif data.get("protocol") == "file":
            maildir = data.get("urlpart")
            mdlib.pull.filepull(maildir, local_maildir, noop, verbose, filterfd)
        else:
            print("md pull: %s not a recognized protocol" % protocol, file=self.stderr)

        # Finally try and close the filterfd
        if filterfd:
            try:
                filterfd.close()
            except:
                if verbose:
                    print("md pull: couldn't close open filter file", file=self.stderr)