def _generate_response_head_bytes(status_code, headers):
    """
    :type status_code: int
    :type headers: dict[str, str]

    :rtype: bytes
    """

    head_string = str(status_code) + _DELIMITER_NEWLINE
    header_tuples = sorted((k, headers[k]) for k in headers)

    for name, value in header_tuples:
        name = _get_header_correctly_cased(name)

        if _should_sign_response_header(name):
            head_string += _FORMAT_HEADER_STRING.format(name, value)

    return (head_string + _DELIMITER_NEWLINE).encode()
:type status_code: int
    :type headers: dict[str, str]

    :rtype: bytes