def get_domain(url):
    """
    Given the following a url extract domain ignoring scheme and params.
    Using urlparse->netloc seems to fail

    >>> get_domain(http://www.contosdo.com)
    www.contosdo.com
    >>> get_domain(www.contosdo.com)
    www.contosdo.com
    >>> get_domain(http://www.contosdo.com/example/?filter=test)
    www.contosdo.com
    >>> get_domain(http://contosdo.com/example/?filter=test)
    contosdo.com

    """
    url = url.split('://')
    index = (0, 1)[len(url) > 1]
    domain = url[index].split('?')[0].split('/')[0].split(':')[0].lower()
    return domain
