def to_sweep(
    sweep_or_resolver_list: (
        Sweep | ParamResolverOrSimilarType | Iterable[ParamResolverOrSimilarType]
    ),
) -> Sweep:
    """Converts the argument into a ``cirq.Sweep``.

    Args:
        sweep_or_resolver_list: The object to try to turn into a
            ``cirq.Sweep`` . A ``cirq.Sweep``, a single ``cirq.ParamResolver``,
            or a list of ``cirq.ParamResolver`` s.

    Returns:
        A sweep equal to or containing the argument.

    Raises:
        TypeError: If an unsupport type was supplied.
    """
    if isinstance(sweep_or_resolver_list, Sweep):
        return sweep_or_resolver_list
    if isinstance(sweep_or_resolver_list, (ParamResolver, dict)):
        resolver = cast(ParamResolverOrSimilarType, sweep_or_resolver_list)
        return ListSweep([resolver])
    if isinstance(sweep_or_resolver_list, Iterable):
        resolver_iter = cast(Iterable[ParamResolverOrSimilarType], sweep_or_resolver_list)
        return ListSweep(resolver_iter)
    raise TypeError(f'Unexpected sweep-like value: {sweep_or_resolver_list}')
Converts the argument into a ``cirq.Sweep``.

    Args:
        sweep_or_resolver_list: The object to try to turn into a
            ``cirq.Sweep`` . A ``cirq.Sweep``, a single ``cirq.ParamResolver``,
            or a list of ``cirq.ParamResolver`` s.

    Returns:
        A sweep equal to or containing the argument.

    Raises:
        TypeError: If an unsupport type was supplied.
    
cirq-core/cirq/study/sweepable.py