def cloropleth_map(data, code_col='CODE', value_col='total',
                   name_col='Country / territory of asylum/residence',
                   title='Syrian Refugees Around Globe 2016'):
    """
    Returns plotly figure for cloropleth map

    Inputs:
        data (pd.DataFrame): main data
        code_col (str): column name for country codes
        value_col: value column for fills
        name_col: name column for text attribute

    Returns:
        fig (dict): plotly figure
    """

    data = [dict(
        type='choropleth',
        locations=data[code_col],
        z=data[value_col],
        text=data[name_col],
        colorscale=[[0, "rgb(5, 10, 172)"], [0.35, "rgb(40, 60, 190)"],
                    [0.5, "rgb(70, 100, 245)"],
                    [0.6, "rgb(90, 120, 245)"], [0.7, "rgb(106, 137, 247)"],
                    [1, "rgb(220, 220, 220)"]],
        autocolorscale=False,
        reversescale=True,
        marker=dict(
            line=dict(
                color='rgb(180,180,180)',
                width=0.5
            )),
        colorbar=dict(
            autotick=False,
            title='Number of Refugees'),
    )]

    layout = dict(
        title=title,
        geo=dict(
            showframe=False,
            showcoastlines=False,
            projection=dict(
                type='Mercator'
            )
        )
    )

    fig = dict(data=data, layout=layout)
    return fig