As shown above, you can use mshr to create your geometry. However, as mshr is no longer maintained, I would suggest using the GMSH python API, pygmsh, dmsh or seismicmesh
A comparison of these mesh generators can be found at GitHub - nschloe/meshgen-comparison: A comparison of mesh generators.