(cls, oid)
Checks if a `oid` string is valid or not.

        :Parameters:
          - `oid`: the object id to validate

        .. versionadded:: 2.3
Checks if a `oid` string is valid or not.
Checks if a oid string is valid or not .
def is_valid(cls, oid):
        """Checks if a `oid` string is valid or not.

        :Parameters:
          - `oid`: the object id to validate

        .. versionadded:: 2.3
        """
        if not oid:
            return False

        try:
            ObjectId(oid)
            return True
        except (InvalidId, TypeError):
            return False
def is_valid ( cls , oid ) : if not oid : return False try : ObjectId ( oid ) return True except ( InvalidId , TypeError ) : return False