def downloading_complete(dct,flag=None):
    """ Utility function: check if all files in the dictionary have been 
        successefully downloaded.
        You can se the flag to:
        * 'op' to only check for final products (forecast are ignored)
        * 'fc' to only check for forecast products (final are ignored)
        * None to either check final or forecast, i.e. a file is considered
          successefully downloaded in either case
    """
    if not flag:
        all([dct[x]['fc'] or dct[x]['op'] for x in dct])
    elif flag == 'fc':
        return all([dct[x]['fc'] for x in dct])
    elif flag=='op':
        return all([dct[x]['op'] for x in dct])
    else:
        raise RuntimeError('[ERROR] Invalid argument to downloading_complete function!')