docs: def create_nic(access_token, subscription_id, resource_group, nic_name, public_ip_id, subnet_id,
                 location, nsg_id=None):
      '''Create a network interface with an associated public ip address.
  
      Args:
          access_token (str): A valid Azure authentication token.
          subscription_id (str): Azure subscription id.
          resource_group (str): Azure resource group name.
          nic_name (str): Name of the new NIC.
          public_ip_id (str): Public IP address resource id.
          subnetid (str): Subnet resource id.
          location (str): Azure data center location. E.g. westus.
          nsg_id (str): Optional Network Secruity Group resource id.
  
      Returns:
          HTTP response. NIC JSON body.
      '''
      endpoint = ''.join([get_rm_endpoint(),
                          '/subscriptions/', subscription_id,
                          '/resourceGroups/', resource_group,
                          '/providers/Microsoft.Network/networkInterfaces/', nic_name,
                          '?api-version=', NETWORK_API])
      nic_body = {'location': location}
      ipconfig = {'name': 'ipconfig1'}
      ipc_properties = {'privateIPAllocationMethod': 'Dynamic'}
      ipc_properties['publicIPAddress'] = {'id': public_ip_id}
      ipc_properties['subnet'] = {'id': subnet_id}
      ipconfig['properties'] = ipc_properties
      properties = {'ipConfigurations': [ipconfig]}
      if nsg_id is not None:
          properties['networkSecurityGroup'] = {'id': nsg_id}
      nic_body['properties'] = properties
      body = json.dumps(nic_body)
      return do_put(endpoint, body, access_token)