<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def csv_list(models, attr, link=False, separator=", "):
 """Return a comma-separated list of models, optionaly with a link."""

    values = []
    for model in models:
        value = getattr(model, attr)
        if link and hasattr(model, "get_admin_url") and callable(model.get_admin_url):
            value = get_admin_html_link(model, label=value)
        values.append(value)
    return separator.join(values)