def validate_draft_recipients(draft):
 if (not any((draft.to_addr, draft.bcc_addr, draft.cc_addr))):
  raise InputError('No recipients specified')
 for field in (draft.to_addr, draft.bcc_addr, draft.cc_addr):
  if (field is not None):
   for (_, email_address) in field:
    parsed = address.parse(email_address, addr_spec_only=True)
    if (not isinstance(parsed, address.EmailAddress)):
     raise InputError(u'Invalid recipient address {}'.format(email_address))

def validate_draft_recipients ( draft ) : if ( not any ( ( draft . to_addr , draft . bcc_addr , draft . cc_addr ) ) ) : raise InputError ( 'No recipients specified' ) for field in ( draft . to_addr , draft . bcc_addr , draft . cc_addr ) : if ( field is not None ) : for ( _ , email_address ) in field : parsed = address . parse ( email_address , addr_spec_only = True ) if ( not isinstance ( parsed , address . EmailAddress ) ) : raise InputError ( u'Invalid recipient address {}' . format ( email_address ) )
check that a draft has at least one recipient .