def _stream_header(file_name, pb_dir):
    """
    Stream the lines of a remote header file.

    Parameters
    ----------
    file_name : str

    pb_dir : str
        The Physiobank database directory from which to find the
        required header file. eg. For file '100.hea' in
        'http://physionet.org/physiobank/database/mitdb', pb_dir='mitdb'.

    """
    # Full url of header location
    url = posixpath.join(config.db_index_url, pb_dir, file_name)
    response = requests.get(url)

    # Raise HTTPError if invalid url
    response.raise_for_status()

    # Get each line as a string
    filelines = response.content.decode('iso-8859-1').splitlines()

    # Separate content into header and comment lines
    header_lines = []
    comment_lines = []

    for line in filelines:
        line = str(line.strip())
        # Comment line
        if line.startswith('#'):
            comment_lines.append(line)
        # Non-empty non-comment line = header line.
        elif line:
            # Look for a comment in the line
            ci = line.find('#')
            if ci > 0:
                header_lines.append(line[:ci])
                # comment on same line as header line
                comment_lines.append(line[ci:])
            else:
                header_lines.append(line)

    return (header_lines, comment_lines)
Stream the lines of a remote header file.

    Parameters
    ----------
    file_name : str

    pb_dir : str
        The Physiobank database directory from which to find the
        required header file. eg. For file '100.hea' in
        'http://physionet.org/physiobank/database/mitdb', pb_dir='mitdb'.