human
Complete this python program:
def get_managed(name, template, source, source_hash, source_hash_name, user, group, mode, attrs, saltenv, context, defaults, skip_verify=False, **kwargs):
assistant
#Here is the Python program you requested.

    """Return the managed file data for file.managed
    name
    location where the file lives on the server
    template
    template format
    source
    managed source file
    source_hash
    hash of the source file
    source_hash_name
    When ``source_hash`` refers to a remote file, this specifies the
    filename to look for in that file.
    .. versionadded:: 2016.3.5
    user
    Owner of file
    group
    Group owner of file
    mode
    Permissions of file
    attrs
    Attributes of file
    .. versionadded:: Oxygen
    context
    Variables to add to the template context
    defaults
    Default values of for context_dict
    skip_verify
    If ``True``, hash verification of remote file sources (``http://``,
    ``https://``, ``ftp://``) will be skipped, and the ``source_hash``
    argument will be ignored.
    .. versionadded:: 2016.3.0
    CLI Example:
    .. code-block:: bash
    salt \*\ file.get_managed /etc/httpd/conf.d/httpd.conf jinja salt://http/httpd.conf \{hash_type: \md5\, \hsum\: <md5sum>}\ None root root \755\ base None None
    """
    sfn = ''
    source_sum = {}
    def _get_local_file_source_sum(path):
        '\n                                DRY    helper    for    getting    the    source_sum    value    from    a    locally    cached\n                                path.\n                                '
        return {'hsum': get_hash(path, form='sha256'), 'hash_type': 'sha256'}
    if source:
        urlparsed_source = _urlparse(source)
        parsed_scheme = urlparsed_source.scheme
        parsed_path = os.path.join(urlparsed_source.netloc, urlparsed_source.path).rstrip(os.sep)
        if (parsed_scheme and (parsed_scheme.lower() in 'abcdefghijklmnopqrstuvwxyz')):
            parsed_path = ':'.join([parsed_scheme, parsed_path])
            parsed_scheme = 'file'
        if (parsed_scheme == 'salt'):
            source_sum = __salt__['cp.hash_file'](source, saltenv)
            if (not source_sum):
                return ('', {}, 'Source    file    {0}    not    found'.format(source))
        elif ((not source_hash) and (parsed_scheme == 'file')):
            source_sum = _get_local_file_source_sum(parsed_path)
        elif ((not source_hash) and source.startswith(os.sep)):
            source_sum = _get_local_file_source_sum(source)
        elif (not skip_verify):
            if source_hash:
                try:
                    source_sum = get_source_sum(name, source, source_hash, source_hash_name, saltenv)
                except CommandExecutionError as exc:
                    return ('', {}, exc.strerror)
            else:
                msg = 'Unable    to    verify    upstream    hash    of    source    file    {0},    please    set    source_hash    or    set    skip_verify    to    True'.format(source)
                return ('', {}, msg)
    if (source and (template or (parsed_scheme in salt.utils.files.REMOTE_PROTOS))):
        cache_refetch = False
        cached_dest = __salt__['cp.is_cached'](source, saltenv)
        if (cached_dest and (source_hash or skip_verify)):
            htype =...