def fd(f):
    return hasattr(f, 'fileno') and f.fileno() or f
Get a filedescriptor from something which could be a file or an fd.
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/core/files/locks.py/fd