def wrap(cls, url):
    """Given a url that is either a string or :class:`Link`, return a :class:`Link`.

    :param url: A string-like or :class:`Link` object to wrap.
    :returns: A :class:`Link` object wrapping the url.
    """
    if isinstance(url, cls):
      return url
    elif isinstance(url, compatible_string):
      return cls(url)
    else:
      raise ValueError('url must be either a string or Link.')