<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _extract_yaml_docstring(stream):
        '''
        Extract the comments at the top of the YAML file,
        from the stream handler.
        Return the extracted comment as string.
        '''
        comment_lines = []
        lines = stream.read().splitlines()
        for line in lines:
            line_strip = line.strip()
            if not line_strip:
                continue
            if line_strip.startswith('#'):
                comment_lines.append(
                    line_strip.replace('#', '', 1).strip()
                )
            else:
                break
        return ' '.join(comment_lines)