def generate_url(resource, bucket_name, object_name, expire=3600):
    """Generate URL for bucket or object."""
    client = resource.meta.client
    url = client.generate_presigned_url('get_object', Params={'Bucket':
        bucket_name, 'Key': object_name}, ExpiresIn=expire)
    return url
