<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sg_restore(sess, save_path, category=''):
 r""" Restores previously saved variables. Args: sess: A `Session` to use to restore the parameters. save_path: Path where parameters were previously saved. category: A `String` to filter variables starts with given category. Returns: """

    # to list
    if not isinstance(category, (tuple, list)):
        category = [category]

    # make variable list to load
    var_list = {}
    for cat in category:
        for t in tf.global_variables():
            if t.name.startswith(cat):
                var_list[t.name[:-2]] = t

    # restore parameters
    saver = tf.train.Saver(var_list)
    saver.restore(sess, save_path)