def is_image_sharable(context, image, **kwargs):
 if context.is_admin:
  return True
 if (context.owner is None):
  return False
 if (context.owner == image['owner']):
  return True
 if ('membership' in kwargs):
  membership = kwargs['membership']
  if (membership is None):
   return False
 else:
  members = image_member_find(context, image_id=image['id'], member=context.owner)
  if members:
   member = members[0]
  else:
   return False
 return member['can_share']

def is_image_sharable ( context , image , ** kwargs ) : if context . is_admin : return True if ( context . owner is None ) : return False if ( context . owner == image [ 'owner' ] ) : return True if ( 'membership' in kwargs ) : membership = kwargs [ 'membership' ] if ( membership is None ) : return False else : members = image_member_find ( context , image_id = image [ 'id' ] , member = context . owner ) if members : member = members [ 0 ] else : return False return member [ 'can_share' ]
return true if the image can be shared to others in this context .