import requests
from bs4 import BeautifulSoup


def _bs_from_response(response):
    """
    Returns BeautifulSoup from given requests response object.

    :param str|requests.Response response:
    :rtype: bs4.BeautifulSoup
    """
    if isinstance(response, requests.Response):
        response = response.text
    return BeautifulSoup(response, "html.parser")