def get_header(instream, comment_char='#'):
    """Returns a header from the stream and an the reaminder of the stream
    with the actual data.

    Parameters
    ----------
    instream : a file object
        An input stream.

    comment_char : str
        The character prepended to header lines (use '@' when parsing sams, 
        '#' when parsing pairsams).

    Returns
    -------
    header : list
        The header lines, stripped of terminal spaces and newline characters.

    remainder_stream : stream/file-like object
        Stream with the remaining lines.
    
    """
    header = []
    if not comment_char:
        raise ValueError('Please, provide a comment char!')
    comment_byte = comment_char.encode()
    inbuffer = instream.buffer
    current_peek = inbuffer.peek()
    while current_peek.startswith(comment_byte):
        line = inbuffer.readline()
        header.append(line.decode().strip())
        current_peek = inbuffer.peek()
    return header, instream
