input: Write a function to filter emails based on valid domains.
  assert filter_emails(['jane@domain1.com', 'john@domain2.com', 'dave@domain3.com', 'sarah@domain4.com'], ['domain1.com', 'domain2.com']) == ['jane@domain1.com', 'john@domain2.com']
  assert filter_emails(['alice@domain5.com', 'bob@domain6.com'], ['domain5.com']) == ['alice@domain5.com']
  assert filter_emails(['charlie@domain7.com', 'dave@domain8.com'], ['domain9.com']) == []
output: def filter_emails(emails, valid_domains):
      return [email for email in emails if email.split('@')[-1] in valid_domains]