def check_name_format(req, name, target_type):
    if not name:
        raise HTTPPreconditionFailed(
            request=req,
            body='%s name cannot be empty' % target_type)
    if isinstance(name, six.text_type):
        name = name.encode('utf-8')
    if '/' in name:
        raise HTTPPreconditionFailed(
            request=req,
            body='%s name cannot contain slashes' % target_type)
    return name
Validate that the header contains valid account or container name.
dataset/ETHPy150Open openstack/swift/swift/common/constraints.py/check_name_format