Is it possible to create a server which would be compatible to be used
with the Address Book system of OsX? I think I must be compatible with
the CardDav system.
Yes you can create such a server and there are plenty already. You can choose between either CardDAV or LDAP, depending on your needs. When LDAP is good enough for your use case, you might get even get away with just configuring OpenLDAP to use your database.
LDAP is usually just read & query only (think big company address book / yellow pages). CardDAV is usually read/write and full sync.
Has anyone already done that?
Many people have, the CalConnect CardDAV Server Implementations site alone lists 16, most of them FOSS. There are more.
If yes, how did you handle it? Created your own server?
I think this is the most common approach.
Is there a CardDav library for Python for example?
Please do your research, this is trivial to figure out ...
Many PHP servers (you mentioned Zend) are using SabreDAV as a basis.
I just want to be able to read my contacts using the Address Book of OsX.
That makes it a lot easier. While you can use a library like SabreDAV, implementing CardDAV readonly is really not that hard. Authentication, a few XML requests for locating an addressbook and then some code to render your existing records as vCards.
If you want to add editing, things get more complicated.