import importlib


def import_from_names(*names):
    """Try to import the same function from various names.

    Example:
        >>> etree = import_from_names(
        ...     'lxml.etree',
        ...     'xml.etree.cElementTree',
        ...     'xml.etree.ElementTree'
        ... )
    """
    for name in names:
        try:
            return importlib.import_module(name)
        except ImportError:
            continue
    return None