docs: def make_xeditable(instance=None, extra_attrs=[], *args, **kwargs):
      """
      Converts the contents of the column into an ``<a>`` tag with the required DOM attributes to
      power the X-Editable UI.
  
      The following keyword arguments are all optional, but may be provided when pre-calling the
      helper, to customize the output of the helper once it is run per object record:
  
          * ``type`` - Defaults to the basic type of the HTML input ("text", "number", "datetime")
          * ``title`` - Defaults to an empty string, controls the HTML "title" attribute.
          * ``placeholder`` - Defaults to whatever "title" is, controls the HTML "placeholder" attribute.
          * ``url`` - Defaults to the ``request.path`` of the view, which will automatically serve the X-Editable interface as long as it inherits from ``XEditableDatatableView``.
          * ``source`` - Defaults to the ``request.path`` of the view, which will automatically serve X-Editable requests for ``choices`` data about a field.
  
      Supplying a list of names via ``extra_attrs`` will enable arbitrary other keyword arguments to
      be rendered in the HTML as attribute as well.  ``extra_attrs`` serves as a whitelist of extra
      names so that unintended kwargs don't get rendered without your permission.
      """
  
      if instance is None:
          # Preloading kwargs into the helper for deferred execution
          helper = partial(make_xeditable, extra_attrs=extra_attrs, *args, **kwargs)
          return helper
  
      # Immediate finalization, return the xeditable structure
      data = kwargs.get('default_value', instance)
      rich_data = kwargs.get('rich_value', data)
  
      # Compile values to appear as "data-*" attributes on the anchor tag
      default_attr_names = ['pk', 'type', 'url', 'source', 'title', 'placeholder']
      valid_attr_names = set(default_attr_names + list(extra_attrs))
      attrs = {}
      for k, v in kwargs.items():
          if k in valid_attr_names:
              if k.startswith('data_'):
                  k = k[5:]
              attrs['data-{0}'.format(k)] = v
  
      attrs['data-xeditable'] = "xeditable"
  
      # Assign default values where they are not provided
  
      field_name = kwargs['field_name']  # sent as a default kwarg to helpers
      if isinstance(field_name, (tuple, list)):
          # Legacy syntax
          field_name = field_name[1]
          if isinstance(field_name, (tuple, list)):
              raise ValueError("'make_xeditable' helper needs a single-field data column,"
                               " not {0!r}".format(field_name))
      attrs['data-name'] = field_name
  
      if isinstance(rich_data, Model):
          attrs['data-value'] = rich_data.pk
      else:
          attrs['data-value'] = rich_data
  
      if 'data-pk' not in attrs:
          attrs['data-pk'] = instance.pk
  
      if 'data-url' not in attrs:
          # Look for a backup data-url
          provider_name = 'get_update_url'
          url_provider = getattr(kwargs.get('view'), provider_name, None)
          if not url_provider:
              url_provider = getattr(instance, provider_name, None)
              if not url_provider and 'view' in kwargs:
                  url_provider = lambda field_name: kwargs['view'].request.path
              else:
                  raise ValueError("'make_xeditable' cannot determine a value for 'url'.")
          if url_provider:
              attrs['data-url'] = url_provider(field_name=field_name)
  
      if 'data-placeholder' not in attrs:
          attrs['data-placeholder'] = attrs.get('data-title', "")
  
      if 'data-type' not in attrs:
          if hasattr(instance, '_meta'):
              # Try to fetch a reasonable type from the field's class
              if field_name == 'pk':  # special field name not in Model._meta.fields
                  field = instance._meta.pk
              else:
                  field = resolve_orm_path(instance, field_name)
  
              if field.choices:
                  field_type = 'select'
              else:
                  field_type = XEDITABLE_FIELD_TYPES.get(field.get_internal_type(), 'text')
          else:
              field_type = 'text'
          attrs['data-type'] = field_type
  
      # type=select elements need to fetch their valid choice options from an AJAX endpoint.
      # Register the view for this lookup.
      if attrs['data-type'] in ('select', 'select2'):
          if 'data-source' not in attrs:
              if 'view' in kwargs:
                  attrs['data-source'] = "{url}?{field_param}={fieldname}".format(**{
                      'url': kwargs['view'].request.path,
                      'field_param': kwargs['view'].xeditable_fieldname_param,
                      'fieldname': field_name,
                  })
                  if attrs['data-type'] == 'select2':
                      attrs['data-source'] += '&select2=true'
              else:
                  raise ValueError("'make_xeditable' cannot determine a value for 'source'.")
  
          # Choice fields will want to display their readable label instead of db data
          data = getattr(instance, 'get_{0}_display'.format(field_name), lambda: data)()
  
      data = u"""<a href="#"{attrs}>{data}</a>""".format(attrs=flatatt(attrs), data=data)
      return data