import requests


def get_html(url, session_obj=None, headers=None):
    """
    Request to the server and receiving a response,
    in the form of an html code of a web page.
    """
    try:
        request = session_obj if session_obj else requests
        response = request.get(url, timeout = 5, headers=headers)
        # Raise an HTTPError exception if the status of the request code is not 2xx. 
        response.raise_for_status()
    except requests.exceptions.HTTPError as http_err:
        print(f'HTTP error: {http_err}')
    except requests.exceptions.RequestException as request_err:
        print(f'Requests error: {request_err}')
    except Exception as err:
        print(f'Other error: {err}')
    else:
        return response.text