<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def build_residential_branches(lvgd):
 """Based on population and identified peak load data, the according grid topology for residential sector is determined and attached to the grid graph Parameters lvgd : LVGridDistrictDing0 Low-voltage grid district object """


    # Choice of typified lv model grid depends on population within lv
    # grid district. If no population is given, lv grid is omitted and
    # load is represented by lv station's peak load
    if lvgd.population > 0 \
            and lvgd.peak_load_residential > 0:
        model_grid = select_grid_model_residential(lvgd)

        build_lv_graph_residential(lvgd, model_grid)

    # no residential load but population
    elif lvgd.population > 0 \
            and lvgd.peak_load_residential == 0:
        logger.warning(
            '{} has population but no residential load. '
            'No grid is created.'.format(
                repr(lvgd)))

    # residential load but no population
    elif lvgd.population == 0 \
            and lvgd.peak_load_residential > 0:
        logger.warning(
            '{} has no population but residential load. '
            'No grid is created and thus this load is '
            'missing in overall balance!'.format(
                repr(lvgd)))

    else:
        logger.info(
            '{} has got no residential load. '
            'No grid is created.'.format(
                repr(lvgd)))