Compress the following string using the gzip library in Python.
String: "This is a sample string to compress."
import gzip

string = "This is a sample string to compress."
compressed_string = gzip.compress(string.encode('utf-8'))
print(compressed_string)