<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_griddistrict(ding0_filepath):
 """ Just get the grid district number from ding0 data file path Parameters ding0_filepath : str Path to ding0 data ending typically `/path/to/ding0_data/"ding0_grids__" + str(``grid_district``) + ".xxx"` Returns ------- int grid_district number """

    grid_district = os.path.basename(ding0_filepath)
    grid_district_search = re.search('[_]+\d+', grid_district)
    if grid_district_search:
        grid_district = int(grid_district_search.group(0)[2:])
        return grid_district
    else:
        raise (KeyError('Grid District not found in '.format(grid_district)))