I need to lock a file geodatabase (or only a single Mosaic dataset) at the beginning of a python script (and release it in the end).. I looked and looked and couldn't find any explicit arcpy command to do this.. Is it even possible to tell the gdb to lock itself? Or is the locking mechanism works autonomously?
Are you looking to lock it for editing rows or editing schema? There are different kinds of fgdb locks.
Have you looked at the ISchemaLock interface? http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#//0001000004qw000000
It looks like for python you can check to see if there is a lock using this code and then do your operations that will lock the schema (like adding a field)
The amount of time that you lock the schema is meant to be kept to a minimum.
If you are using ArcGIS for Desktop 10.1 (you have not specified your version), then the Editor class of the Data Access module (arcpy.da) looks like it may meet this requirement.