

def build_plural_mappings(special_mappings, resource_map):
    "Create plural to singular mapping for all resources.\n\n    Allows for special mappings to be provided, for particular cases..\n    Otherwise, will strip off the last character for normal mappings, like\n    routers -> router, unless the plural name ends with 'ies', in which\n    case the singular form will end with a 'y' (e.g.: policy/policies)\n    "
    plural_mappings = {
        
    }
    for plural in resource_map:
        singular = special_mappings.get(plural)
        if (not singular):
            if plural.endswith('ies'):
                singular = ('%sy' % plural[:(- 3)])
            else:
                singular = plural[:(- 1)]
        plural_mappings[plural] = singular
    return plural_mappings

dataset/ETHPy150Open openstack/neutron/neutron/api/v2/resource_helper.py build_plural_mappings/original