+ return (fingerprints, sigkey_missing, key_cannot_encrypt)
+
+
+def is_key_usable (key_obj):
+ """Returns boolean representing key usability regarding encryption
+
+ Tests various feature of key and returns usability
+
+ Args:
+ key_obj: a gpgme key object
+
+ Returns:
+ A boolean representing key usability
+ """
+ if key_obj.can_encrypt and not key_obj.invalid and not key_obj.expired \
+ and not key_obj.revoked and not key_obj.disabled:
+ return True
+ else:
+ return False
+
+
+def test_auto_reply (email_bytes):
+ """Test whether email is auto-generated
+
+ If the email is autogenerated, edward quits without sending a response.
+ This is not a perfect test. Some auto-responses will go undetected.
+
+ Args:
+ email_bytes: the byte string from of the email
+
+ Returns:
+ Nothing, or exits the program
+ """
+
+ email_struct = email.parser.BytesHeaderParser().parsebytes(email_bytes)
+
+ auto_submitted = email_struct['Auto-Submitted']
+
+ if auto_submitted == None or auto_submitted == "no" \
+ or auto_submitted == "No":
+
+ return
+
+ debug("autoreply")
+ exit(0)