def translate_urls(json_home, new_prefix):
 for (dummy_rel, resource) in json_home['resources'].items():
  if ('href' in resource):
   resource['href'] = (new_prefix + resource['href'])
  elif ('href-template' in resource):
   resource['href-template'] = (new_prefix + resource['href-template'])

def translate_urls ( json_home , new_prefix ) : for ( dummy_rel , resource ) in json_home [ 'resources' ] . items ( ) : if ( 'href' in resource ) : resource [ 'href' ] = ( new_prefix + resource [ 'href' ] ) elif ( 'href-template' in resource ) : resource [ 'href-template' ] = ( new_prefix + resource [ 'href-template' ] )
given a json home document .