def _get_contact_name(args, required):
    """
    Force user to input contact name if one wasn't given in the args.
    Used for SEND, READ, and SETPREF commands.
    :param args: Command-line args to be checked for the contact name
    :param required: If the contact name must be specified, or it's optional
    :return: The contact name, or None
    """
    contact_name = ''
    # build the contact name (can span multiple words)
    for name in args.contact_name:
        contact_name += name + ' '

    contact_name = contact_name.strip()

    while not contact_name and required:
        print('You must specify a Contact Name for Send and Read and SetPref commands. ' +
              'Enter one now:')
        try:
            contact_name = input('Enter a new contact name (CTRL + C to give up): ').strip()
        except (EOFError, KeyboardInterrupt):
            # gave up
            print()
            return None

    return contact_name