import re


def _obtain_filename_from_response(response):
    """Obtains the filename from a requests response object
    Args:
        response: a response object

    Returns:
        filename: a string
    """
    content_disposition = response.headers.get("content-disposition")
    filename = re.findall('filename=(.+)', content_disposition) \
        if content_disposition else None
    filename = (None if len(filename)==0 else filename[0]) \
        if filename else None

    return filename