def _get_subnet(subnet_id, session=None, **kwargs):
    if isinstance(subnet_id, (int, long)):
        return utils.get_db_object(
            session, models.Subnet,
            id=subnet_id, **kwargs
        )
    raise exception.InvalidParameter(
        'subnet id %s type is not int compatible' % subnet_id
    )
Get subnet by subnet id.
dataset/ETHPy150Open openstack/compass-core/compass/db/api/network.py/_get_subnet