Is there any libraries(python is preffered) for generation rectangular 3d mesh (for using with the finite difference method), which will be consistent with boundaries? (I've asked this question at stackoverflow, but nothing)
I'm partial to gmsh, but it's more of a standalone tool rather than a library you can call from another program. Google directed me to SALOME, which does have proper python bindings, but again is mostly a standalone program. I haven't used it, but OpenFOAM has a mesh generator built in which might suit your needs.
There's a long list of mesh generation software here, but you'll find that most of the 3D mesh generators are either (1) tetrahedral, (2) have weird licensing agreements under which you have to provide proof you're an American fruit bat over the age of 36 to get it, (3) no longer maintained, (4) are not free.
I would only add to what Daniel Shapero said that gmsh can be used as both an executable and a library. It also has python bindings.