def _noderef(N, prefix, label=None, ext=None):
    """ Return an anchor HTML token referring to a Node view.
      N: the Node to which to link.
      prefix: URL base prefix to prepend.
      label: visible text for the link, default N.name.
      ext: suffix for the link URL, default '.html'.
  """
    if not prefix.endswith('/'):
        raise ValueError(
            'noderef(N=%s,...): prefix does not end in a slash: %s' % (N,
            prefix))
    if prefix == '/':
        raise ValueError('bad prefix: %s' % (prefix,))
    if label is None:
        label = N.name
    if ext is None:
        ext = '/'
    return ['A', {'HREF': '%s%s:%s%s' % (prefix, N.type, N.name, ext)}, label]
