<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_comment_group_for_path(self, pathname, default_content_type=None):
 """ Obtains the comment group for a specified pathname. :param pathname: The path for which the comment group will be obtained. :return: Returns the comment group for the specified pathname or raises a ``ValueError`` if a content type is not found or raises a ``KeyError`` if a comment group is not found. Usage: [['#', '']] [['/*', '*/'], ['//', '']] Traceback (most recent call last):
 KeyError: 'No comment groups for content type `structured-text` for file `foobar.rst` found' # If the content type cannot be determined, we assume the content # type to be ``python`` in this case. [['#', '']] Traceback (most recent call last):
 ValueError: No content type defined for file path: foobar.f37993ajdha73 Traceback (most recent call last):
 ValueError: No content type defined for file path: foobar.f37993ajdha73 """

        content_type = self.guess_content_type(pathname)
        if not content_type:
            # Content type is not found.
            if default_content_type:
                content_type = default_content_type
                return self.get_comment_group(content_type)
            else:
                raise ValueError(
                    "No content type defined for file path: %s" % pathname)
        else:
            try:
                return self.get_comment_group(content_type)
            except KeyError:
                raise KeyError(
                    "No comment groups for content type `%s` for file `%s` found" % (
                    content_type, pathname))