<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sign(filename):
 """Returns detached signature for file"""


    if gnupg is None:
        return

    gpg = gnupg.GPG()

    with open(filename, "rb") as signfile:
        keyid = fingerprint2keyid(config["gpg_key_fingerprint"])

        if keyid is None:
            msg = "No private key for GPG fingerprint '{}'."
            raise ValueError(msg.format(config["gpg_key_fingerprint"]))

        signed_data = gpg.sign_file(signfile, keyid=keyid, detach=True)

    return signed_data