public static function from($iterable)
    {
        if (is_array($iterable)) {
            return $iterable;
        }
        // Don't mean to play favorites, but want to optimize where we can.
        if ($iterable instanceof ImmutableBag) {
            return $iterable->toArray();
        }
        if ($iterable instanceof Traversable) {
            return iterator_to_array($iterable);
        }
        if ($iterable === null) {
            return [];
        }
        if ($iterable instanceof \stdClass) {
            return (array) $iterable;
        }

        Assert::nullOrIsIterable($iterable);
    }