def getid(obj):
    """
    Abstracts the common pattern of allowing both an object or an object's ID
    (integer) as a parameter when dealing with relationships.
    """
    try:
        return obj.id
    except __HOLE__:
        return int(obj)
dataset/ETHPy150Open jacobian-archive/openstack.compute/openstack/compute/base.py/getid