<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_document(self):
 """Parse any ResourceSync document and show information. Will use sitemap URI taken either from explicit self.sitemap_name or derived from the mappings supplied. """

        s = Sitemap()
        self.logger.info("Reading sitemap(s) from %s ..." % (self.sitemap))
        try:
            list = s.parse_xml(url_or_file_open(self.sitemap))
        except IOError as e:
            raise ClientFatalError("Cannot read document (%s)" % str(e))
        num_entries = len(list.resources)
        capability = '(unknown capability)'
        if ('capability' in list.md):
            capability = list.md['capability']
        print("Parsed %s document with %d entries" % (capability, num_entries))
        if (self.verbose):
            to_show = 100
            override_str = ' (override with --max-sitemap-entries)'
            if (self.max_sitemap_entries):
                to_show = self.max_sitemap_entries
                override_str = ''
            if (num_entries > to_show):
                print(
                    "Showing first %d entries sorted by URI%s..." %
                    (to_show, override_str))
            n = 0
            for resource in list:
                print('[%d] %s' % (n, str(resource)))
                n += 1
                if (n >= to_show):
                    break