static function getPaEx( $ezcoid, $checkIfUserHasDatatype = false )
    {
        $currentPaex = eZPaEx::fetch( $ezcoid );

        // If we don't have paex object for the current object id, create a default one
        if ( !$currentPaex instanceof eZPaEx )
        {
            // unless user does not have paex datatype
            if ( $checkIfUserHasDatatype )
            {
                //eZContentObject::fetch( $ezcoid );
                $paexDataTypeCount = eZPersistentObject::count( eZContentObjectAttribute::definition(),
                                                array( 'contentobject_id' => $ezcoid,
                                                       'data_type_string' => ezpaextype::DATA_TYPE_STRING ),
                                                'id' );
                if ( !$paexDataTypeCount )
                {
                    eZDebug::writeDebug( "User id {$ezcoid} does not have paex datatype", __METHOD__ );
                    return null;
                }
            }
            return eZPaEx::create( $ezcoid );
        }

        // Get default paex values from ini to use in case there is anyone missing in the object
        $ini = eZINI::instance( 'mbpaex.ini' );
        $iniPasswordValidationRegexp = $ini->variable( 'mbpaexSettings', 'PasswordValidationRegexp' );
        $iniDefaultPasswordLifeTime  = $ini->variable( 'mbpaexSettings', 'DefaultPasswordLifeTime' );
        $iniExpirationNotification   = $ini->variable( 'mbpaexSettings', 'ExpirationNotification' );

        // If still any empty values in the paex object, set defaults from ini
        if ( !$currentPaex->hasRegexp() )
        {
            $currentPaex->setAttribute( 'passwordvalidationregexp', $iniPasswordValidationRegexp );
            eZDebug::writeDebug( 'Regexp empty, used default: "' . $iniPasswordValidationRegexp .'"', 'eZPaEx::getPaEx' );
        }
        if ( !$currentPaex->hasLifeTime() )
        {
            $currentPaex->setAttribute( 'passwordlifetime', $iniDefaultPasswordLifeTime );
            eZDebug::writeDebug( 'PasswordLifeTime empty, used default: "' . $iniDefaultPasswordLifeTime . '"', 'eZPaEx::getPaEx' );
        }
        if ( !$currentPaex->hasNotification() )
        {
            $currentPaex->setAttribute( 'expirationnotification', $iniExpirationNotification );
            eZDebug::writeDebug( 'ExpirationNotification empty, used default: "' . $iniPasswordValidationRegexp . '"', 'eZPaEx::getPaEx' );
        }

        eZDebug::writeDebug( 'PasswordLastUpdated value: "' . $currentPaex->attribute( 'password_last_updated' ) . '"', 'eZPaEx::getPaEx' );

        return $currentPaex;
    }