Get ANSI command code by name.

def ansi_cmd(cmd, *args):
    """Get ANSI command code by name."""
    try:
        obj = getattr(ANSI, str('cmd_{}'.format(cmd)))
    except AttributeError:
        raise ValueError(
            "incorrect command: {!r}".format(cmd))
    if isinstance(obj, type("")):
        return obj
    else:
        return obj(*args)