def send_draft(account, draft, db_session):
 update_draft_on_send(account, draft, db_session)
 response_on_success = APIEncoder().jsonify(draft)
 try:
  sendmail_client = get_sendmail_client(account)
  sendmail_client.send(draft)
 except SendMailException as exc:
  kwargs = {}
  if exc.failures:
   kwargs['failures'] = exc.failures
  if exc.server_error:
   kwargs['server_error'] = exc.server_error
  return err(exc.http_code, exc.message, **kwargs)
 return response_on_success

def send_draft ( account , draft , db_session ) : update_draft_on_send ( account , draft , db_session ) response_on_success = APIEncoder ( ) . jsonify ( draft ) try : sendmail_client = get_sendmail_client ( account ) sendmail_client . send ( draft ) except SendMailException as exc : kwargs = { } if exc . failures : kwargs [ 'failures' ] = exc . failures if exc . server_error : kwargs [ 'server_error' ] = exc . server_error return err ( exc . http_code , exc . message , ** kwargs ) return response_on_success
send the draft with id = draft_id .