def convert_to_vcard(name, value, allowed_object_type):
if isinstance(value, str):<EOL><INDENT>if allowed_object_type == ObjectType.list_with_strings:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>" + name + "<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>return value.strip()<EOL><DEDENT><DEDENT>elif isinstance(value, list):<EOL><INDENT>if allowed_object_type == ObjectType.string:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>" + name + "<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>for entry in value:<EOL><INDENT>if not isinstance(entry, str):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>" + name + "<STR_LIT>")<EOL><DEDENT><DEDENT>return [x.strip() for x in value if x]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if allowed_object_type == ObjectType.string:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>" + name + "<STR_LIT>")<EOL><DEDENT>elif allowed_object_type == ObjectType.list_with_strings:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>" + name + "<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>" + name + "<STR_LIT>")<EOL><DEDENT><DEDENT>
converts user input into vcard compatible data structures
    :param name: object name, only required for error messages
    :type name: str
    :param value: user input
    :type value: str or list(str)
    :param allowed_object_type: set the accepted return type for vcard
        attribute
    :type allowed_object_type: enum of type ObjectType
    :returns: cleaned user input, ready for vcard or a ValueError
    :rtype: str or list(str)