def format_import(names):
    """Format an import line"""
    parts = []
    for _, name, asname in names:
        if asname is None:
            parts.append(name)
        else:
            parts.append(name + " as " + asname)
    line = "import " + ", ".join(parts) + "\n"
    return line