<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def to_list(i, use_keys=False):
    '''
    Converts items to a list.

    :param i: Item to convert

        * If `i` is ``None``, the result is an empty list

        * If `i` is 'string', the result won't be \
        ``['s', 't', 'r',...]`` rather more like ``['string']``

        * If `i` is a nested dictionary, the result will be a flattened list.

    :param use_keys:
        If i is a dictionary, use the keys instead of values
    :returns:
        All items in i as list
    '''

    from photon.util.system import shell_notify

    if not i:
        return []
    if isinstance(i, str):
        return [i]
    if isinstance(i, list):
        return i
    if isinstance(i, dict):
        res = list()
        for e in i.keys() if use_keys else i.values():
            res.append(to_list(e)) if isinstance(e, dict) else res.append(e)
        return res
    shell_notify('type for %s uncovered' % (i), state=True, more=type(i))