Item: extract validate_name method from set_name

Extract validate_name method from set_name and also reuse it from
System.set_name.
Speed-up Item.validate_name by 1.4-3.8x

Use a regular expression instead of plain string operations to validate
the name.

Benchmarks taken on an i7-3770 CPU with python-2.7.5-11.fc20.x86_64 show
speed-ups from 1.4 to 3.8 for *valid names*.

A regular expression for invalid names speeds up things a bit more, but
it makes the code uglier:

    _invalid_name_regex1 = re.compile(r'[^a-zA-Z0-9_\-.:+]')

    if self._invalid_name_regex1.search(name):
        raise Exception("invalid characters in name: '%s'" % name)

For example for name "1JyYFtxUpV5xk.e+46T6U+88eUEv", the speed-up is
3.631 instead of 3.514.
Merge pull request #971 from ciupicri/master-optimizations

Item.set_name optimizations