'Creates a signed CloudFront URL that is only valid within the specified
parameters.
:type url: str
:param url: The URL of the protected object.
:type keypair_id: str
:param keypair_id: The keypair ID of the Amazon KeyPair used to sign
theURL.  This ID MUST correspond to the private key
specified with private_key_file or private_key_string.
:type expire_time: int
:param expire_time: The expiry time of the URL. If provided, the URL
will expire after the time has passed. If not provided the URL will
never expire. Format is a unix epoch.
Use int(time.time() + duration_in_sec).
:type valid_after_time: int
:param valid_after_time: If provided, the URL will not be valid until
after valid_after_time. Format is a unix epoch.
Use int(time.time() + secs_until_valid).
:type ip_address: str
:param ip_address: If provided, only allows access from the specified
IP address.  Use \'192.168.0.10\' for a single IP or
use \'192.168.0.0/24\' CIDR notation for a subnet.
:type policy_url: str
:param policy_url: If provided, allows the signature to contain
wildcard globs in the URL.  For example, you could
provide: \'http://example.com/media/\*\' and the policy
and signature would allow access to all contents of
the media subdirectory. If not specified, only
allow access to the exact url provided in \'url\'.
:type private_key_file: str or file object.
:param private_key_file: If provided, contains the filename of the
private key file used for signing or an open
file object containing the private key
contents.  Only one of private_key_file or
private_key_string can be provided.
:type private_key_string: str
:param private_key_string: If provided, contains the private key string
used for signing. Only one of private_key_file or
private_key_string can be provided.
:rtype: str
:return: The signed URL.'

def create_signed_url(self, url, keypair_id, expire_time=None, valid_after_time=None, ip_address=None, policy_url=None, private_key_file=None, private_key_string=None):

    params = self._create_signing_params(url=url, keypair_id=keypair_id, expire_time=expire_time, valid_after_time=valid_after_time, ip_address=ip_address, policy_url=policy_url, private_key_file=private_key_file, private_key_string=private_key_string)
    if ('?' in url):
        sep = '&'
    else:
        sep = '?'
    signed_url_params = []
    for key in ['Expires', 'Policy', 'Signature', 'Key-Pair-Id']:
        if (key in params):
            param = ('%s=%s' % (key, params[key]))
            signed_url_params.append(param)
    signed_url = ((url + sep) + '&'.join(signed_url_params))
    return signed_url
