def contained_name(name1, name2):
    """
    Compares two lists of names (strings) and checks to see if all the names in one list also appear in the other list

    Parameters
    ----------
    name1: list
        list of strings to be compared to name2
    name2: list
        list of strings to be compared to name1

    Returns
    -------
    integer
        1 if contained, else 0

    Example
    --------
    >>> name1 = ['JOHN', 'JOHN', 'DAVE', 'JIM']
    >>> name2 = ['JOHN', 'DAVE']
    >>> contained_name(name1, name2)
    1
    """
    # Common elements
    common_elements = 0

    # Compare unique values in both lists
    words1 = set(name1.split())
    for word in set(name2.split()):
        if word in words1:
            common_elements += 1

    # Minimum no. of elements
    min_elements = min(len([s[0] for s in name1.split()]),
                       len([t[0] for t in name2.split()]))

    # Contained Indicator
    if min_elements > 1 and min_elements == common_elements:
        contained = 1
    else:
        contained = 0
    return contained