<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def display_vega(vega_data: dict, display: bool = True) -> Union['Vega', dict]: """Optionally display vega dictionary. Parameters vega_data : Valid vega data as dictionary display: Whether to try in-line display in IPython """

    if VEGA_IPYTHON_PLUGIN_ENABLED and display:
        from vega3 import Vega
        return Vega(vega_data)
    else:
        return vega_data