<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def style(theme=None, context='paper', grid=True, gridlines=u'-', ticks=False, spines=True, fscale=1.2, figsize=(8., 7.)):
 """ main function for styling matplotlib according to theme ::Arguments:: theme (str):
 'oceans16', 'grade3', 'chesterish', 'onedork', 'monokai', 'solarizedl', 'solarizedd'. If no theme name supplied the currently installed notebook theme will be used. context (str):
 'paper' (Default), 'notebook', 'talk', or 'poster' grid (bool):
 removes axis grid lines if False gridlines (str):
 set grid linestyle (e.g., '--' for dashed grid) ticks (bool):
 make major x and y ticks visible spines (bool):
 removes x (bottom) and y (left) axis spines if False fscale (float):
 scale font size for axes labels, legend, etc. figsize (tuple):
 default figure size of matplotlib figures """


    # set context and font rc parameters, return rcdict
    rcdict = set_context(context=context, fscale=fscale, figsize=figsize)

    # read in theme name from ~/.jupyter/custom/current_theme.txt
    if theme is None:
        theme = infer_theme()

    # combine context & font rcparams with theme style
    set_style(rcdict, theme=theme, grid=grid, gridlines=gridlines, ticks=ticks, spines=spines)