@staticmethod
    def _sign_string(message, private_key_file=None, private_key_string=None):
        """
        Signs a string for use with Amazon CloudFront.  Requires the M2Crypto
        library be installed.
        """
        try:
            from M2Crypto import EVP
        except __HOLE__:
            raise NotImplementedError("Boto depends on the python M2Crypto "
                                      "library to generate signed URLs for "
                                      "CloudFront")
        # Make sure only one of private_key_file and private_key_string is set
        if private_key_file and private_key_string:
            raise ValueError("Only specify the private_key_file or the private_key_string not both")
        if not private_key_file and not private_key_string:
            raise ValueError("You must specify one of private_key_file or private_key_string")
        # if private_key_file is a file object read the key string from there
        if isinstance(private_key_file, file):
            private_key_string = private_key_file.read()
        # Now load key and calculate signature
        if private_key_string:
            key = EVP.load_key_string(private_key_string)
        else:
            key = EVP.load_key(private_key_file)
        key.reset_context(md='sha1')
        key.sign_init()
        key.sign_update(str(message))
        signature = key.sign_final()
        return signature
dataset/ETHPy150Open darcyliu/storyboard/boto/cloudfront/distribution.py/Distribution._sign_string