code: def ReplaceUserDefinedFunction(self, udf_link, udf, options=None):
          
          if options is None:
              options = {}
  
          CosmosClient.__ValidateResource(udf)
          udf = udf.copy()
          if udf.get('serverScript'):
              udf['body'] = str(udf['serverScript'])
          elif udf.get('body'):
              udf['body'] = str(udf['body'])
  
          path = base.GetPathFromLink(udf_link)
          udf_id = base.GetResourceIdOrFullNameFromLink(udf_link)
          return self.Replace(udf,
                              path,
                              'udfs',
                              udf_id,
                              None,
                              options)
docs: Replaces a user defined function and returns it.
  
          :param str udf_link:
              The link to the user defined function.
          :param dict udf:
          :param dict options:
              The request options for the request.
  
          :return:
              The new UDF.
          :rtype:
              dict