How to get the absolute path?
You need not reinvent the wheel, you can use functions from menu File -> External data -> make all 
 paths relative (absolute). The python code of this comands are:

bpy.ops.file.make_paths_relative()

bpy.ops.file.make_paths_absolute()