def _fetch(self, value, arg):
        try:
            message = self.spam[self._mailbox][value - 1]
            message_id = value
        except __HOLE__:
            for x, item in enumerate(self.spam[self._mailbox]):
                if item["uid"] == value:
                    message = item
                    message_id = x + 1
                    break

        parts = "headers"
        if arg in ("(ALL)", "(RFC822 FLAGS)"):
            parts = "complete"

        return ("OK", (("%s " % message_id, message[parts]), message["flags"]))
dataset/ETHPy150Open uwdata/termite-data-server/web2py/gluon/contrib/mockimaplib.py/Connection._fetch