def safe_get_design(request, design_type, design_id=None):
 design = None
 if (design_id is not None):
  design = authorized_get_design(request, design_id)
 if (design is None):
  design = SavedQuery(owner=request.user, type=design_type)
 return design

def safe_get_design ( request , design_type , design_id = None ) : design = None if ( design_id is not None ) : design = authorized_get_design ( request , design_id ) if ( design is None ) : design = SavedQuery ( owner = request . user , type = design_type ) return design
return a new design .