def to_list(x):
    """Convert a value to a list.

    Parameters
    ----------
    x
        Value.

    Returns
    -------
    `list`

    Examples
    --------
    >>> to_list(0)
    [0]
    >>> to_list({'x': 0})
    [{'x': 0}]
    >>> to_list(x ** 2 for x in range(3))
    [0, 1, 4]
    >>> x = [1, 2, 3]
    >>> to_list(x)
    [1, 2, 3]
    >>> _ is x
    True
    """
    if isinstance(x, list):
        return x
    if not isinstance(x, dict):
        try:
            return list(x)
        except TypeError:
            pass
    return [x]
