import shutil


def cp_dir(src_dir, dest_dir):

    """Function:  cp_dir

    Description:  Copies a directory from source to destination.

    Arguments:
        (input) src_dir -> Source directory.
        (input) dest_dir -> Destination directory.
        (output) status -> True|False - True if copy was successful.
        (output) err_msg -> Error message from copytree exception or None.

    """

    status = True
    err_msg = None

    try:
        shutil.copytree(src_dir, dest_dir)

    # Directory permission error.
    except shutil.Error as err:
        err_msg = "Directory not copied.  Perms Error Message: %s" % (err)
        status = False

    # Directory does not exist.
    except OSError as err:
        err_msg = "Directory not copied.  Exist Error Message: %s" % (err)
        status = False

    return status, err_msg