code: def get_uid(value):
      
      if not value:
          return ''
      # Is value a brain?
      if ICatalogBrain.providedBy(value):
          value = value.getObject()
      # validate UID
      uid = value.UID()
      uc = get_tool('uid_catalog')
      if uc(UID=uid):
          # The object is valid
          return uid
      # Otherwise the object is an old version
      brains = uc(portal_type=value.portal_type, Title=value.Title())
      if not brains:
          # Cannot find UID
          raise RuntimeError('The UID for %s/%s cannot be found!' %
                             (value.portal_type, value.Title()))
      if len(brains) > 1:
          # Found multiple objects, this is a failure
          raise RuntimeError('Searching for %s/%s returned multiple objects.' %
                             (value.portal_type, value.Title()))
      return brains[0].UID
docs: Takes a brain or object and returns a valid UID.
      In this case, the object may come from portal_archivist, so we will
      need to do a catalog query to get the UID of the current version