<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register_theme(self, theme: ModuleType) -> None: """Set theme for this docuemnt. This method sets theme's js/css files and headers on this document. :arg ModuleType theme: a module which has ``js_files``, ``css_files``, ``headers``, and ``extended_classes``. see ``wdom.themes`` directory actual theme module structures. """

        if not hasattr(theme, 'css_files'):
            raise ValueError('theme module must include `css_files`.')
        for css in getattr(theme, 'css_files', []):
            self.add_cssfile(css)
        for js in getattr(theme, 'js_files', []):
            self.add_jsfile(js)
        for header in getattr(theme, 'headers', []):
            self.add_header(header)
        for cls in getattr(theme, 'extended_classes', []):
            self.defaultView.customElements.define(cls)