def _read_header_lines(base_record_name, dir_name, pb_dir):
    """
    Read the lines in a local or remote header file.

    Parameters
    ----------
    base_record_name : str
        The base name of the WFDB record to be read, without any file
        extensions.
    dir_name : str
        The local directory location of the header file. This parameter
        is ignored if `pb_dir` is set.
    pb_dir : str
        Option used to stream data from Physiobank. The Physiobank
        database directory from which to find the required record files.
        eg. For record '100' in 'http://physionet.org/physiobank/database/mitdb'
        pb_dir='mitdb'.

    Returns
    -------
    header_lines : list
        List of strings corresponding to the header lines.
    comment_lines : list
        List of strings corresponding to the comment lines.

    """
    file_name = base_record_name + '.hea'

    # Read local file
    if pb_dir is None:
        with open(os.path.join(dir_name, file_name), 'r') as fp:
            # Record line followed by signal/segment lines if any
            header_lines = []
            # Comment lines
            comment_lines = []
            for line in fp:
                line = 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)
    # Read online header file
    else:
        header_lines, comment_lines = download._stream_header(file_name,
                                                              pb_dir)

    return header_lines, comment_lines