code: def resource_id(**kwargs):
      
      kwargs = {k: v for k, v in kwargs.items() if v is not None}
      rid_builder = ['/subscriptions/{subscription}'.format(**kwargs)]
      try:
          try:
              rid_builder.append('resourceGroups/{resource_group}'.format(**kwargs))
          except KeyError:
              pass
          rid_builder.append('providers/{namespace}'.format(**kwargs))
          rid_builder.append('{type}/{name}'.format(**kwargs))
          count = 1
          while True:
              try:
                  rid_builder.append('providers/{{child_namespace_{}}}'
                                     .format(count).format(**kwargs))
              except KeyError:
                  pass
              rid_builder.append('{{child_type_{0}}}/{{child_name_{0}}}'
                                 .format(count).format(**kwargs))
              count += 1
      except KeyError:
          pass
      return '/'.join(rid_builder)
docs: Create a valid resource id string from the given parts.
  
      This method builds the resource id from the left until the next required id parameter
      to be appended is not found. It then returns the built up id.
  
      :param dict kwargs: The keyword arguments that will make up the id.
  
          The method accepts the following keyword arguments:
              - subscription (required): Subscription id
              - resource_group:          Name of resource group
              - namespace:               Namespace for the resource provider (i.e. Microsoft.Compute)
              - type:                    Type of the resource (i.e. virtualMachines)
              - name:                    Name of the resource (or parent if child_name is also \
              specified)
              - child_namespace_{level}: Namespace for the child resoure of that level (optional)
              - child_type_{level}:      Type of the child resource of that level
              - child_name_{level}:      Name of the child resource of that level
  
      :returns: A resource id built from the given arguments.
      :rtype: str