def __new__(cls, arg, ignore_nonimports=False, ignore_shadowed=False):
    """
        Return as an `ImportSet`.

        :param ignore_nonimports:
          If ``False``, complain about non-imports.  If ``True``, ignore
          non-imports.
        :param ignore_shadowed:
          Whether to ignore shadowed imports.  If ``False``, then keep all
          unique imports, even if they shadow each other.  Note that an
          ``ImportSet`` is unordered; an ``ImportSet`` with conflicts will only
          be useful for very specific cases (e.g. set of imports to forget
          from known-imports database), and not useful for outputting as code.
          If ``ignore_shadowed`` is ``True``, then earlier shadowed imports are
          ignored.
        :rtype:
          `ImportSet`
        """
    if isinstance(arg, cls):
        if ignore_shadowed:
            return cls._from_imports(arg._importset, ignore_shadowed=True)
        else:
            return arg
    return cls._from_args(arg, ignore_nonimports=ignore_nonimports,
        ignore_shadowed=ignore_shadowed)
