Abaqus: how to define an element-based surface using Python?

I would like to define a Surface using Python (my aim is to change BCs after each step in the analysis). So I would like to select the elements on the surface of the solid which satisfy a given condition (related to their location in the deformed shape) and define a surface with them (in that surface I apply a pressure load).

How could I do this?