def get_file_ids(service, search=None, max_files=250):
    """
    Get a dictionary of filenames:file_ids from the authenticated Drive account. 
    Can filter with search string. Returns / searches through most recent 250 files by default.

    Returns:
        file_ids, a dictionary of filenames:file_ids    
    """


    file_ids = {}

    results = service.files().list(
        pageSize=max_files,fields="nextPageToken, files(id, name)").execute()
    items = results.get('files', [])

    if not items:
        print('No files found.')
        return None


    for item in items:
        #print('{0} ({1})'.format(item['name'], item['id']))
        if search is None or item['name'].find(search) > 0:
            file_ids[item['name']] = item['id']

    return file_ids