def get_cookies(response):
    """
    Helper function to retreive the cookies from a response.
    """
    cookie_string = response.headers.get('Set-Cookie')
    cookies = {
        w.split('=')[0]:w.split('=')[1]
        for w in cookie_string.split('; ')
    }
    return cookies