def _time2table_(timestr,table_type='flow'):
    """ Given timestr of format 'YYYYMMDD:HHMM' produce string of format 'YYYYMM'
    This function is used to map a time to a table, to be able to divide data
    into multiple tables for faster search. May be updated if further data
    division is required, e.g. one table per day
    """
    if table_type == 'flow' or table_type == 'exchange' or table_type == 'capacity':
        return timestr[0:4]  # currently one table per year
    else: # return year by default
        return timestr[0:4]