import requests
from bs4 import BeautifulSoup


def extract_url(url, values=None):
    """Given an url, extracts the contents as a BeautifulSoup object.

    Args:
       url: URL to parse.

    Returns:
        The site contents as a BeautifulSoup object
    """
    if values:
        r = requests.post(url, data=values)
    else:
        r = requests.get(url)

    # Create the soup :)
    html_raw = r.text
    soup = BeautifulSoup(html_raw, 'lxml')  # Here we use lxml, because the default html.parser is not working properly...

    return soup