'Creates and returns a Key with provided data. If no bucket is given,
a temporary bucket is created.'

def _MakeKey(self, data='', bucket=None, set_contents=True):

    if (data and (not set_contents)):
        raise ValueError('MakeKey    called    with    a    non-empty    data    parameter    but    set_contents    was    set    to    False.')
    if (not bucket):
        bucket = self._MakeBucket()
    key_name = self._MakeTempName()
    k = bucket.new_key(key_name)
    if set_contents:
        k.set_contents_from_string(data)
    return k
