Get model by identifier

def get_by_id(cls, id):
        """ Get model by identifier """

        if any((isinstance(id, basestring) and id.isdigit(), isinstance(id,
               (int, float)))):
            return cls.query.get(int(id))
        return None