Get a user by email - Groovy script

I'm trying to dynamically assign a task to a user. I only have the email as a way to identify the user.

So how can I retrieve a user by email?

I know that we can use the below to get the user by a specific username 

return apiAccessor.getIdentityAPI().getUserByUserName('username').id

Hi,

Where this email comes from ? Is it stored in the User contact data ?