def _validate_resource(resource):
 try:
  if (resource is not None):
   resource = resourceprep(resource)
   if (not resource):
    raise InvalidJID(u'Resource must not be 0 bytes')
   if (len(resource) > 1023):
    raise InvalidJID(u'Resource must be less than 1024 bytes')
   return resource
 except stringprep_profiles.StringPrepError:
  raise InvalidJID(u'Invalid resource')

def _validate_resource ( resource ) : try : if ( resource is not None ) : resource = resourceprep ( resource ) if ( not resource ) : raise InvalidJID ( u'Resource must not be 0 bytes' ) if ( len ( resource ) > 1023 ) : raise InvalidJID ( u'Resource must be less than 1024 bytes' ) return resource except stringprep_profiles . StringPrepError : raise InvalidJID ( u'Invalid resource' )
validate the resource portion of a jid .