def parse_header(line):
    """Parse a header line.

    Args:
        line: A header line as a string.

    Returns:
        None if end of headers is found. A string giving the continuation line
        if a continuation is found. A tuple of name, value when a header line is
        found.

    Raises:
        ValueError: If the line cannot be parsed as a header.
    """
    if not line or line == "\r\n":
        return None
    if line[0] in " \t":
        return line[1:].rstrip()
    name, value = line.split(":", 1)
    return (name.strip(), value.strip())