refactor rewriting metadata
update the docstrings of the new metadata handling function
introduce a new exception for too small metadata section
refactor for readability
check for MetadataSectionTooSmall
Merge branch 'feature/refactor_rewrite_metadata' into feature/append

* feature/refactor_rewrite_metadata:
  check for MetadataSectionTooSmall
  refactor for readability
  introduce a new exception for too small metadata section
  update the docstrings of the new metadata handling function
  refactor rewriting metadata
another suggestions for what to check when appending