def validate_pattern(pattern):
    """Validate a pattern suppied by the user

    Parameters
    ----------
    pattern : str

    Returns
    -------
    tuple
        bool True/False
            True if OK, False if error
        str
            Returned value or  Error
    """

    pattern = pattern.strip()
    if not any(pattern):
        return (False, 'Pattern cannot be empty')
    if ',' in pattern \
       or ' ' in pattern:
        return (False, 'Pattern cannot contain spaces or commas')
    return(True, pattern)