def _remote_file_exists(s3_conn, bucket_name, remote_filename):
    b = None
    for i in range(0, 5):
        try:
            b = s3_conn.get_bucket(bucket_name)
            break
        except S3ResponseError:
            log.error ("Problem connecting to bucket '%s', attempt %s/5" % (bucket_name, i))
            time.sleep(2)

    if b is not None:
        k = Key(b, remote_filename)
        if k.exists():
            return True
    return False
dataset/ETHPy150Open chapmanb/cloudbiolinux/installed_files/ec2autorun.py/_remote_file_exists/original