Signs a message using a shared secret.

    :param shared_secret: The shared secret used to sign the message
    :param msg: The message to sign

    :return: The signature as a string

    .. doctest::

     >>> from cloud.rpc import sign
     >>> sign('sEcReT_KeY', 'hello world')
     '5f048ebaf6f06576b60716dc8f815d85'

def sign(shared_secret, msg):
    """Signs a message using a shared secret.

    :param shared_secret: The shared secret used to sign the message
    :param msg: The message to sign

    :return: The signature as a string

    .. doctest::

     >>> from cloud.rpc import sign
     >>> sign('sEcReT_KeY', 'hello world')
     '5f048ebaf6f06576b60716dc8f815d85'
    """
    if isinstance(msg, unicode):
        msg = msg.encode('utf8')
    return hashlib.md5(msg + shared_secret).hexdigest()