@contextlib.contextmanager
def try_target_cell(context, cell):
 if cell:
  with nova_context.target_cell(context, cell) as cell_context:
   (yield cell_context)
 else:
  (yield context)

@ contextlib . contextmanager def try_target_cell ( context , cell ) : if cell : with nova_context . target_cell ( context , cell ) as cell_context : ( yield cell_context ) else : ( yield context )
if cell is not none call func with context .