Are you familiar with the Book of Philip?
“The impure spirits take male and female [forms]. The males are those that are intimate with the souls which dwell in a female form, and the females are those that mingle with those in a male form through disobedience.”
https://www.gospels.net/philip