def validate_image(values):
 status = values.get('status')
 status = values.get('status', None)
 if (not status):
  msg = 'Image status is required.'
  raise exception.Invalid(msg)
 if (status not in STATUSES):
  msg = ("Invalid image status '%s' for image." % status)
  raise exception.Invalid(msg)
 return values

def validate_image ( values ) : status = values . get ( 'status' ) status = values . get ( 'status' , None ) if ( not status ) : msg = 'Image status is required.' raise exception . Invalid ( msg ) if ( status not in STATUSES ) : msg = ( "Invalid image status '%s' for image." % status ) raise exception . Invalid ( msg ) return values
validates the incoming data and raises a invalid exception if anything is out of order .