def metadata_dict_to_str(metadata, attr_name=None):
    """
    Returns the metadata dict into a string

    Ex:
    metadata = {"app_id": "myapp", "color": "blue"}
    return "app_id: myapp, color: blue"
    """
    attr_name = attr_name or "metadata"
    metadata = getattr(metadata, attr_name)
    if metadata is None:
        return "None"
    mystr = ""
    items = len(metadata)
    for k, v in metadata.iteritems():
        mystr += "{}: {}".format(k, v)
        items -= 1
        if items >= 1:
            mystr += ", "
    return mystr